I have the following code that I am using from this link (modified slightly) to remove or add my All select as needed. Works perfectly for my input 2....but I have 5 more inputs I want it to do the exact same functionality on. I can't really find much documentation on the methods available for mvc.Components, so I can't tell if there is a getClass, or some similar functionality. Anyone have a clue on how I can do below, but for all inputs matching input2 - input8? Relevant code is from line 11 through 34
Edit: Can't add links to answers from this site yet.....
require(['jquery','underscore','splunkjs/mvc', 'website_status_cell_renderer', 'splunkjs/mvc/simplexml/ready!'],
function($, _, mvc, WebsiteStatusCellRenderer){
var statusTable = mvc.Components.get('element2');
statusTable.getVisualization(function(tableView){
tableView.table.addCellRenderer(new WebsiteStatusCellRenderer());
tableView.table.render();
});
var selection = [];
var multi = mvc.Components.getInstance("input2");
multi.on("change", function(){
// get the current selection
selection = multi.val();
// check if there is more than one entry and one of them is "*"
if (selection.length > 1 && ~(selection.indexOf("*"))) {
if (selection.indexOf("*") == 0) {
// "*" was first, remove it and leave rest
selection.splice(selection.indexOf("*"), 1);
multi.val(selection);
multi.render();
} else {
// "*" was added later, remove rest and leave "*"
multi.val("*");
multi.render();
}
} else if ( selection.length < 1){
multi.val("*");
multi.render();
}
});
}
);
... View more