Skip to content

Commit 9163eaa

Browse files
committed
Auto select dropdown option if only one
Also, making sure boolean values are boolean
1 parent 083692c commit 9163eaa

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Diff for: client/assetmgmt.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ function fillFilters() {
123123
var select = document.querySelector("select#text" + filter);
124124
var option = document.createElement("option");
125125
option.text = option.value = "Select a filter";
126-
option.disabled = option.selected = "true";
126+
option.disabled = option.selected = true;
127127
select.add(option);
128128

129129
unique.forEach(function(value) {
@@ -132,6 +132,11 @@ function fillFilters() {
132132
select.add(option);
133133
select.disabled = false;
134134
});
135+
136+
if (select.length == 2) {
137+
// One actual option, first is disabled "Select" text
138+
select.children[1].selected = true;
139+
}
135140
});
136141
}
137142

@@ -209,7 +214,7 @@ function showTable(response) {
209214
var filterList = document.createElement("select");
210215
filterList.id = "text" + filter;
211216
filterList.name = filter;
212-
filterList.disabled = "false"; // until content is loaded
217+
filterList.disabled = false; // until content is loaded
213218

214219
filterList.addEventListener("change", function() {
215220
filterTable(this.name);

0 commit comments

Comments
 (0)