0

Why don’t Dojo SelectBoxes have a “Select All” function?

It’s kind of annoying to me that Dojo SelectBoxes do not have the ability to select all items with a single function call. It’s kind of strange. I can understand their connection to data stores to keep the data, but how can they not have selectBox.selectAll()?

To have the ability to select all items and clear a select box that swaps selected items with a second right hand select box, I had to use the following semi-convoluted code:

var selectItem1 = dijit.byId('firstSelectBox');

// Deselect all and invert to Select all
selectItem1.set("value",[]);
selectItem1.invertSelection();

//Move items to right box
var selectItem2 = dijit.byId('secondSelectBox');
selectItem2.addSelected(selectItem1);

I guess we could make our own custom extension of the class, but seems like it should already be in there. maybe it’s a deliberate decision of the Dojo team. Just odd.

jfox015

Leave a Reply

Your email address will not be published. Required fields are marked *