The number of cells is 8 (4 rows and 2 columns). From the specified SD file, (the first) 8 structures are loaded into the table.
<script LANGUAGE="JavaScript1.1" SRC="../../../marvin.js"></script> <script LANGUAGE="JavaScript1.1"> <!-- // number of structures in the SD file var max = 8; var col = 2; var vcol = 2; var vrow = 2; if(max < 2) { col = 1; row = 1; } else { row = Math.floor((max + 1) / col); } if(vcol > col) { vcol = col; } if(vrow > row) { vrow = row; } mview_name="MView" mview_begin("../../..",430,440); if(max > 1) { mview_param("rows",row) mview_param("cols",col) mview_param("visibleCols",vcol) mview_param("visibleRows",vrow) mview_param("border",1) mview_param("layout",":2:1:M:1:0:1:1:c:b:1:1:L:0:0:1:1:c:n:0:1") mview_param("param",":M:200:200:L:10b") for(i=0;i<(row*col);i++) { mview_param("cell"+i,"||"+(i+1)) } } mview_param("mol","../../mols-2d/mols.sdf") mview_end() //--></script>
The max variable determines the number of cells in the molecule table.
Based on its value, we can calculate the parameters of the molecule
table (rows, cols, visibleCols,
visibleRows).
The cell0,cell1,... parameters set
the content of the cells. But the molecules are specified later, by using
the mol parameter.
This parameter specifies the input file containing the structures for the
cells.
This code is easy to extend. By changing the value of the max variable and the mol applet parameter, you can use this example to display another SD file. If you want to load all structures from an SD file, you have to know the number of structures in the file to correctly initialize the applet.
The next example shows how to alter the structures of the table with MarvinSketch.