10
0
mirror of https://github.com/LCPQ/QUESTDB_website.git synced 2024-12-25 13:53:48 +01:00

Merge branch 'master' into multipledataset

This commit is contained in:
Mickaël Véril 2019-09-28 16:05:04 +02:00
commit 0a756bb317

View File

@ -16,19 +16,19 @@ draft: false
window.onload= async ()=>{ window.onload= async ()=>{
$('#form input[type=radio]').on('change', async function(event) { $('#form input[type=radio]').on('change', async function(event) {
var result = $(this).val(); var result = $(this).val();
var files=[]; var proms=[];
switch (result) { switch (result) {
case "abs": case "abs":
files=getAbsFilesName(); proms==getAbsFilesName().map((f) => absDataFile.loadAsync(f));
break; break;
case "fluo": case "fluo":
files=getFluoFilesName(); proms=getFluoFilesName().map((f) => fluoDataFile.loadAsync(f));
break; break;
case "zpe": case "zpe":
files=getZPEFilesName(); proms=getZPEFilesName().map((f) => ZPEDataFile.loadAsync(f));
break; break;
} }
window.dats=await Promise.all(files.map((f) => ZPEDataFile.loadAsync(f))) window.dats=await Promise.all(proms)
reloadSelect() reloadSelect()
reloadContent() reloadContent()
}) })
@ -47,16 +47,14 @@ draft: false
} }
function reloadContent(){ function reloadContent(){
var filt=window.dats var filt=window.dats
$('#dat_table > thead > tr > th > select').each(function(){ $('#form > select').each(function(){
const prop=$(this).data("prop") const prop=$(this).attr("name")
const value=$(this).val() const values=$(this).val()
filt=filt.filter((d)=>{ filt=filt.filter((d)=>{
if(value==""){ if(typeof values=="undefined" || values==null){
return true return false
}
else {
return d[prop]==value
} }
return values.map((v)=>JSON.stringify(v)).includes(JSON.stringify(d[prop]))
}) })
}) })
var tb=document.getElementById("table_b"); var tb=document.getElementById("table_b");
@ -84,21 +82,13 @@ draft: false
<input type="radio" id="zpe" value="zpe" name="datatype"> <input type="radio" id="zpe" value="zpe" name="datatype">
<label for="zpe">\(\Delta \text{ZPE}\)</label> <label for="zpe">\(\Delta \text{ZPE}\)</label>
<br/> <br/>
<select id="mol_select" onchange="reloadContent()" name="molecule"> <select multiple id="mol_select" onchange="reloadContent()" name="molecule"></select>
<option value="">All</option>
</select>
<label for="mol_select">Molecule</label> <label for="mol_select">Molecule</label>
<select id="code_select" onchange="reloadContent()" name="code"> <select multiple id="code_select" onchange="reloadContent()" name="code"></select>
<option value="">All</option>
</select>
<label for="code_select">Code</label> <label for="code_select">Code</label>
<select id="method_select" onchange="reloadContent()" name="method"> <select multiple id="method_select" onchange="reloadContent()" name="method"></select>
<option value="">All</option>
</select>
<label for="method_select">Method</label> <label for="method_select">Method</label>
<select id="DOI_select" onchange="reloadContent()" name="DOI"> <select multiple id="DOI_select" onchange="reloadContent()" name="DOI"></select>
<option value="">All</option>
</select>
<label for="DOI_select">DOI</label> <label for="DOI_select">DOI</label>
</form> </form>
<br/> <br/>