aboutsummaryrefslogtreecommitdiff
path: root/assets/src/js/main.js
diff options
context:
space:
mode:
authorNavan Chauhan <navanchauhan@gmail.com>2021-03-14 12:49:43 +0530
committerNavan Chauhan <navanchauhan@gmail.com>2021-03-14 12:49:43 +0530
commit9999c6cd9ab120e7aa107638ce5d2924b1c48756 (patch)
tree2f4fa11c7978040b7dde326fc93283577962f7ca /assets/src/js/main.js
parentf27b930331cc5dc70d070de4a10459d551dd597e (diff)
changed fixed value to dynamic
Diffstat (limited to 'assets/src/js/main.js')
-rw-r--r--assets/src/js/main.js26
1 files changed, 22 insertions, 4 deletions
diff --git a/assets/src/js/main.js b/assets/src/js/main.js
index 936215e..dbcc4a6 100644
--- a/assets/src/js/main.js
+++ b/assets/src/js/main.js
@@ -44,10 +44,28 @@ function draw_me_like_one_of_your_french_girls(mol){
function calculate_and_disperse(mol){
- var descrs = JSON.parse(mol.get_descriptors());
- document.getElementById('exactmw').textContent = descrs["exactmw"];
- document.getElementById('CrippenMR').textContent = descrs["CrippenMR"];
- document.getElementById('CrippenClogP').textContent = descrs["CrippenClogP"];
+ try {
+ var descrs = JSON.parse(mol.get_descriptors());
+ } catch(err) {
+ alert("oo wee, failed to calculate descriptors senpai")
+ }
+ //document.getElementById('exactmw').textContent = descrs["exactmw"];
+ //document.getElementById('CrippenMR').textContent = descrs["CrippenMR"];
+ //document.getElementById('CrippenClogP').textContent = descrs["CrippenClogP"];
+ let tableRef = document.getElementById("analyse_table");
+ const keys = Object.keys(descrs);
+ for (let i = 0; i < keys.length; i++) {
+ const key = keys[i];
+ console.log(key, descrs[key]);
+ var newRow = tableRef.insertRow(-1);
+ var newCell_label = newRow.insertCell(0);
+ var newCell_value = newRow.insertCell(-1);
+ var newText_label = document.createTextNode(key);
+ var newText_value = document.createTextNode(descrs[key]);
+ newCell_label.appendChild(newText_label);
+ newCell_value.appendChild(newText_value);
+ }
+
}