dynamically create table

This commit is contained in:
Navan Chauhan 2021-03-14 15:13:31 +05:30
parent df97df0db3
commit 849fe34689
1 changed files with 22 additions and 11 deletions

View File

@ -38,12 +38,19 @@ function get_smiles_from_element_text(el_id){
function draw_me_like_one_of_your_french_girls(mol){
mol.condense_abbreviations();
var canvas = document.getElementById("draw-canvas-2");
mol.draw_to_canvas(canvas, -1, -1);
//var canvas = document.getElementById("draw-canvas-2");
//mol.draw_to_canvas(canvas, -1, -1);
var dest = document.getElementById("draw-output");
var svg = mol.get_svg();
dest.outerHTML = "<div id='drawing-1'>" + svg + "</div>";
console.log(svg)
}
function calculate_and_disperse(mol){
const shy_values_do_not_show = ["NumUnspecifiedAtomStereoCenters","NumAliphaticHeterocycles",
"NumSaturatedHeterocycles","NumAromaticHeterocycles","NumAmideBonds","NumAromaticRings","NumAliphaticRings"
,"NumSaturatedRings","NumSpiroAtoms","NumBridgeheadAtoms","NumAtomStereoCenters"]
try {
var descrs = JSON.parse(mol.get_descriptors());
} catch(err) {
@ -56,6 +63,9 @@ function calculate_and_disperse(mol){
const keys = Object.keys(descrs);
for (let i = 0; i < keys.length; i++) {
const key = keys[i];
if(shy_values_do_not_show.indexOf(key) !== -1){
console.log("skipping")
} else{
console.log(key, descrs[key]);
var newRow = tableRef.insertRow(-1);
var newCell_label = newRow.insertCell(0);
@ -65,6 +75,7 @@ function calculate_and_disperse(mol){
newCell_label.appendChild(newText_label);
newCell_value.appendChild(newText_value);
}
}