Commit b20d6255 authored by Otto Jonassen Wittner's avatar Otto Jonassen Wittner
Browse files

Sorting of select-lists added.

parent bef50937
Pipeline #50548 passed with stages
in 1 minute and 3 seconds
...@@ -442,6 +442,10 @@ function make_prop_select(id, names, desc){ ...@@ -442,6 +442,10 @@ function make_prop_select(id, names, desc){
option.text = text; option.text = text;
selectList.appendChild(option); selectList.appendChild(option);
} }
// Sort list alphabetically (from https://stackoverflow.com/questions/667010/sorting-dropdown-list-using-javascript/667198#667198)
$("#" + id).html($("#" + id + " option").sort(function (a, b) {
return a.text == b.text ? 0 : a.text < b.text ? -1 : 1
}))
} }
...@@ -2021,22 +2025,8 @@ $(document).ready ( function(){ ...@@ -2021,22 +2025,8 @@ $(document).ready ( function(){
// event_type parameter change // event_type parameter change
$("#event_type").change( function(){ $("#event_type").change( function(){
parms.event = $("#event_type").val() parms.event = $("#event_type").val()
// Refresh measurement variable (property) select list update_props();
prop_names = prop_names_list[ parms.event ];
//remove_links(); //remove_links();
prop_names = prop_names_list[ parms.event ];
make_prop_select("prop_select", prop_names, prop_desc );
// Select measurement variable
if (parms.property && (prop_names.indexOf(parms.property) > -1)) {
$("#prop_select").val(parms.property);
} else {
// Apply default measurement variable/property if available
if ( "default_field" in conffile[parms.net].event_type[parms.event] ) {
$("#prop_select").val(conffile[parms.net].event_type[parms.event].default_field);
}
parms.property = $("#prop_select").val()
}
get_connections(); get_connections();
update_url(); update_url();
$("#tabs").tabs("option", "active", 0); $("#tabs").tabs("option", "active", 0);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment