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

Jeff Fox is an over twenty-year web developer and digital user experience technology leader. Jeff cut his teeth in the Web's early days and is mainly self-taught in his professional skills. Having worked for a broad number of companies has helped build skills in development, organization and public speaking. In addition to being a passionate developer and technical speaker, Jeff is a dedicated tech and sci-fi geek gladly indulging in Doctor Who and Star Wars marathons. He is also a talented musician, writer and proud father of three little Foxies. And don't get him started about his San Francisco Giants.

Leave a Reply

Your email address will not be published.

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.