Reputation: 71
I've got a CheckedMultiSelect which was created programmatically.
new dojox.form.CheckedMultiSelect({
id: 'products',
name: 'products',
multiple: true,
readOnly: false,
store: store,
},'products').startup();
So far so good. MultiSelect is created. Now, I open webpage with multiselect, check some checkboxes and use Chrome console:
var productSelect = dijit.byId("products");
productSelect.get('value');
[4, 3]
[4, 3] is an array of checked values.
My next step is uncheck previously checked boxes and use Chrome console again:
productSelect.set('value', [4, 3]);
And this is the place where problem has occured. The function 'set' is not working. Boxes are not being selected.
I've even tried
productSelect.set('value', ['4', '3']);
Any ideas?
Upvotes: 2
Views: 4249
Reputation: 71
Ok, i found an answer here.
However, dijit.form.Select possesses an important limitation: it is implemented in such a way that it does not handle non-string item identities well. Particularly, setting the current value of the widget programmatically via select.set("value", id) will not work with non-string (e.g. numeric) identities.
The solution is to cast ids in store to strings and use
productSelect.set('value', ['4', '3']);
Upvotes: 5