I currently have a dojo checkbox group (dijit.form.CheckBox with names in the form “some_name[]”) It works exactly as desired however I need to add a select all button/link, preferably not another checkbox (this shouldn’t be necessary given the functionality will be implemented in js).
Is the a “dojo” way to do this as using standard js seems to get the elements fine but setting element.checked=true has no effect. For the purposes of testing, I’ve disabled the dijit.form.CheckBox (so I have regular bog standard checkboxes) and I am able to mark all the boxes checked with the code that is failing when dojo’ified.
I’m running dojo 1.5 if that makes any difference
UPDATE:
OK, it seems to be setting the checkbox to be checked/unchecked but not re-rendering the dojo widget. I’m also being told that the checkboxes don’t have any of the method I would expect them to have as dijit.form.CheckBox objects (like the set() method).
So I found out what the problem was. I was doing dojo.query() to get the checkbox group dom nodes. This however doesn’t return the dijit widget. To get those I had to do:
By manipulating the widget it visually updates correctly. Also, I wasn’t aware that the checkbox input element isn’t the widget itself so
dijit.byNode(node)returns undefined because the checkbox node doesn’t match any of the initialised dijit widgets.