Adding the ‘All’ value to a dropdown

Users will commonly want to be able to filter on specific values or all values from a dropdown list,
unless specific requirements deem this unnecessary, I always add an ‘ All ‘ value to dropdowns.

When we look at filtering with dropdowns, we can use the ‘All’ value to remove the dimension filter.

Dropdown_1.addItem('All');  /* Add the ‘All’ value (you could alternatively manually add it at design time to the dropdown widget – thus this line of script wouldn’t required */
var members = Table_1.getDataSource().getMembers("Sales_Manager"); 
for (var i=0;i<members.length;i++)      {Dropdown_1.addItem(members[i].id,members[i].description);}
Dropdown_1.setSelectedKey('All');  
// Set the dropdown selected value to ‘All’ (depends on use case)

Code language: JavaScript (javascript)
Scroll to Top