10
0
mirror of https://github.com/LCPQ/QUESTDB_website.git synced 2024-08-26 06:01:49 +02:00

Fix a bug when molecule change and better implementation of cleaning

This commit is contained in:
Mickaël Véril 2019-10-03 11:41:52 +02:00
parent 4b2c6c5187
commit 114b198d83

View File

@ -42,9 +42,9 @@ draft: false
async function update_mol(molecule){ async function update_mol(molecule){
for (const [key,dat] of Object.entries(window.dats)) { for (const [key,dat] of Object.entries(window.dats)) {
var s=document.getElementById(String.raw`select_${key}`) var s=document.getElementById(String.raw`select_${key}`)
while (s.options[s.options.length-1].value!= "") { $(s).find('option[value!=""]').remove()
s.options.remove(s.options[s.options.length-1]) $(s).find('option[value=""]').first().prop('selected', true)
}
dat.forEach((val,index)=>{ dat.forEach((val,index)=>{
if(val.molecule==molecule){ if(val.molecule==molecule){
var op=document.createElement("option") var op=document.createElement("option")
@ -71,10 +71,16 @@ draft: false
dat= await data.loadAsync(file); dat= await data.loadAsync(file);
await applyData(dat); await applyData(dat);
} }
async function clear(){
for(id of ["ex_table_b","data_par","abs_plot"]){
document.getElementById(id).innerHTML=""
}
}
async function reload() { async function reload() {
clear()
const LatexInline=['\\(','\\)'] const LatexInline=['\\(','\\)']
var par=document.getElementById("data_par") var par=document.getElementById("data_par")
par.innerHTML='';
var md=[]; var md=[];
var els=[]; var els=[];
var customRenderingProp=["excitations","sourceFile"] var customRenderingProp=["excitations","sourceFile"]
@ -127,7 +133,6 @@ draft: false
div.appendChild(node); div.appendChild(node);
} }
var tb=document.getElementById("ex_table_b"); var tb=document.getElementById("ex_table_b");
tb.innerHTML=''
for (const el of window.data.excitations) { for (const el of window.data.excitations) {
var row=document.createElement("tr") var row=document.createElement("tr")
var rowd=[] var rowd=[]