I see what the problem is now. The downside of custom JS code is that Splunk could change the structure of its elements under the hood and break your code, which is what happened here. Looks like Splunk 8.x changed some things under the hood. Not only is the "input-multiselect" class gone (which broke my original code that worked for any number of multi-selects), the id that you specified is now appended with a number (which breaks the new single multi-select code).
Try this code and see if it works:
require([
'splunkjs/mvc',
'splunkjs/mvc/simplexml/ready!'
], function(mvc) {
function setupMultiInput(instance_id) {
// Get multiselect
var multi = mvc.Components.get(instance_id);
// On change, check selection
multi.on("change", (selectedValues) => {
if (selectedValues.length > 1 && selectedValues.includes("*")) {
var indexOfAll = selectedValues.indexOf("*");
// If "ALL" was selected before current (more specific) selection, remove it from list
if (indexOfAll == 0) {
selectedValues.splice(indexOfAll, 1);
multi.val(selectedValues);
multi.render();
} else {
// "ALL" was selected last, clear input and leave only "ALL" in it
multi.val("*");
multi.render();
}
}
});
}
var all_multi_selects = document.getElementsByClassName("splunk-multidropdown");
for (j = 0; j < all_multi_selects.length; j++) {
setupMultiInput(all_multi_selects[j].id);
}
});
... View more