diff --git a/content/multipledataset.html b/content/multipledataset.html index 5610a8e3..414dbf4b 100644 --- a/content/multipledataset.html +++ b/content/multipledataset.html @@ -8,7 +8,7 @@ draft: false - + @@ -36,7 +36,7 @@ draft: false function reloadSelect(){ $('#form > select').each(function(){ $(this).find('option[value!=""]').remove() - const vals=new Set(window.dats.map((d)=>{return d[$(this).attr("name")]})) + const vals=uniq(window.dats.map((d)=>{return d[$(this).attr("name")]})) for (const val of vals){ op=document.createElement("option") op.value=val diff --git a/static/scripts/uniq.js b/static/scripts/uniq.js new file mode 100644 index 00000000..d492b157 --- /dev/null +++ b/static/scripts/uniq.js @@ -0,0 +1,8 @@ +function uniq(array) +{ + return uniqueArray = array.filter((obj1,index) => { + return index === array.findIndex(obj2 => { + return JSON.stringify(obj1) === JSON.stringify(obj2); + }); + }); +} \ No newline at end of file