mirror of
https://github.com/LCPQ/QUESTDB_website.git
synced 2024-12-25 05:43:46 +01:00
Fix unicity of select values
This commit is contained in:
parent
bbd993bd1c
commit
3b6860a574
@ -8,7 +8,7 @@ draft: false
|
||||
<script src="/scripts/getFullDataPath.js" type="text/javascript"></script>
|
||||
<script src="/scripts/getTextFromFile.js" type="text/javascript"></script>
|
||||
<script src="/scripts/trueTypeOf.js" type="text/javascript"></script>
|
||||
<script src="/scripts/noNan.js"></script>
|
||||
<script src="/scripts/uniq.js"></script>
|
||||
<script src="https://cdn.rawgit.com/larsgw/citation.js/archive/citation.js/citation-0.4.0-9.js"
|
||||
type="text/javascript"></script>
|
||||
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
|
||||
@ -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
|
||||
|
8
static/scripts/uniq.js
Normal file
8
static/scripts/uniq.js
Normal file
@ -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);
|
||||
});
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue
Block a user