dynamically create table
This commit is contained in:
parent
df97df0db3
commit
849fe34689
|
@ -38,12 +38,19 @@ function get_smiles_from_element_text(el_id){
|
||||||
function draw_me_like_one_of_your_french_girls(mol){
|
function draw_me_like_one_of_your_french_girls(mol){
|
||||||
|
|
||||||
mol.condense_abbreviations();
|
mol.condense_abbreviations();
|
||||||
var canvas = document.getElementById("draw-canvas-2");
|
//var canvas = document.getElementById("draw-canvas-2");
|
||||||
mol.draw_to_canvas(canvas, -1, -1);
|
//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){
|
function calculate_and_disperse(mol){
|
||||||
|
const shy_values_do_not_show = ["NumUnspecifiedAtomStereoCenters","NumAliphaticHeterocycles",
|
||||||
|
"NumSaturatedHeterocycles","NumAromaticHeterocycles","NumAmideBonds","NumAromaticRings","NumAliphaticRings"
|
||||||
|
,"NumSaturatedRings","NumSpiroAtoms","NumBridgeheadAtoms","NumAtomStereoCenters"]
|
||||||
try {
|
try {
|
||||||
var descrs = JSON.parse(mol.get_descriptors());
|
var descrs = JSON.parse(mol.get_descriptors());
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
|
@ -55,15 +62,19 @@ function calculate_and_disperse(mol){
|
||||||
let tableRef = document.getElementById("analyse_table");
|
let tableRef = document.getElementById("analyse_table");
|
||||||
const keys = Object.keys(descrs);
|
const keys = Object.keys(descrs);
|
||||||
for (let i = 0; i < keys.length; i++) {
|
for (let i = 0; i < keys.length; i++) {
|
||||||
const key = keys[i];
|
const key = keys[i];
|
||||||
console.log(key, descrs[key]);
|
if(shy_values_do_not_show.indexOf(key) !== -1){
|
||||||
var newRow = tableRef.insertRow(-1);
|
console.log("skipping")
|
||||||
var newCell_label = newRow.insertCell(0);
|
} else{
|
||||||
var newCell_value = newRow.insertCell(-1);
|
console.log(key, descrs[key]);
|
||||||
var newText_label = document.createTextNode(key);
|
var newRow = tableRef.insertRow(-1);
|
||||||
var newText_value = document.createTextNode(descrs[key]);
|
var newCell_label = newRow.insertCell(0);
|
||||||
newCell_label.appendChild(newText_label);
|
var newCell_value = newRow.insertCell(-1);
|
||||||
newCell_value.appendChild(newText_value);
|
var newText_label = document.createTextNode(key);
|
||||||
|
var newText_value = document.createTextNode(descrs[key]);
|
||||||
|
newCell_label.appendChild(newText_label);
|
||||||
|
newCell_value.appendChild(newText_value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue