Reputation: 1743
I am using dojo1.7 and ComboBoxes and I am having a problem setting default values. I noticed that setting value works correctly (as it should of course :-)....
<div data-dojo-type="dojo.store.Memory" data-dojo-id="stateStore" data-dojo-props="data: [{id: 'y', name: 'yes'}, {id: 'n', name: 'no'}]"></div>
<input data-dojo-type="dijit.form.ComboBox" data-dojo-props="store:stateStore, searchAttr:'name'" value="yes" name="state" id="stateInput">
I noticed that when you take out the value="yes" attribute, the ComboBox no longer has a default selected value from the store.
Is there some way that you can set the default value to the first value in a store? Reason I ask this is because I plan on using a lot of dynamic generated JSON data and being able to just "default to the first value" would be very beneficial.
Janie
Upvotes: 0
Views: 1018
Reputation: 1978
I'm not sure how to do that declaratively but :
If you can do the programmatic trick, it might allow for finer grained operations.
Upvotes: 2