Handle multiple selection of molecules in Marvin applet

User 0d291c241a

24-04-2014 02:28:01

Hi,


I am using Marvin applets (version 6.2.2) and load multiple molecules in a scrollable table like the example (https://www.chemaxon.com/marvin/examples/applets/view/javascripting.html).


In the example, each cgi works for each moelcule.


But I need one cgi (or java script) to handle multiple selection. 


If three moleculs are checked, how do I know which three ones? Is there any way to implement it?


Thank you.


Euna

ChemAxon 2c555f5717

24-04-2014 13:48:03

Dear Euna,


   With some cheat you can do it. You can write a JavaScript function that saves to a global variable which molecule is selected and which is not. Than you can use this information to start searching with multiple molecules. E.g.:


//The max number of loaded molecules should be set as a constant value.
var MAX_NUMBER_OF_MOLECULES = 10;

var selection = new Array();

//This method should be run on pageload
function initSelection() {
for(var i=0; i<MAX_NUMBER_OF_MOLECULES; ++i) {
selection=false;
}
}

function toogleSelection(cellNum) {
if(selection[cellNum)) {
selection[cellNum]=false;
} else {
selection[cellNum]=true;
}
}

function startSearch() {
for(var i=0; i<MAX_NUMBER_OF_MOLECULES; ++i) {
if(selection) {
//Do search with mview.getM(i, "mrv");
}
}

Regards:
Balázs 

User 0d291c241a

25-04-2014 08:31:50

Dear Balázs,


Thank you. I try it.


Euna