i want to load values in drop down list dynamically.but it throws error.code is below.Please help.
HTML CODE:
<select id="FeatureType" dojotype="dijit.form.ComboBox" style="width:300px;font-size:18px; margin-top:55px;margin-left:660px;position:fixed;direction:rtl;fixed;z-index:90;" autoComplete="true" forceValidOption="false" value="Select Feature" ></select>
script code:
var newArr = [];
newArr.push({ name: "ALdddddddddddL0" });
newArr.push({ name: "ALdddddddddddL1" });
newArr.push({ name: "ALdddddddddddL2" });
newArr.push({ name: "ALdddddddddddL3" });
var dataItems = { identifier: 'name', label: 'name', items: newArr };
var store = new dojo.data.ItemFileReadStore({ data: dataItems });
dijit.byId('mySelect').store = store;
but it through error.i have already call the required libraries in page
cannot set property 'store' of undefined.
Please help.It is in dojo.
Thanks in advance.
Solved! Go to Solution.
Nadir,
In the code you provided I do not see a html select with an id of mySelect. Are you sure that portion of your code is correct? Also I always set my store using this code:
dijit.byId('mySelect').set("store", memStore);
Nadir,
In the code you provided I do not see a html select with an id of mySelect. Are you sure that portion of your code is correct? Also I always set my store using this code:
dijit.byId('mySelect').set("store", memStore);
<select id="FeatureType" dojotype="dijit.form.ComboBox" style="width:300px;font-size:18px; margin-top:55px;margin-left:660px;position:fixed;direction:rtl;fixed;z-index:90;" autoComplete="true" forceValidOption="false" value="Select Feature" ></select>
script code:
var newArr = [];
newArr.push({ name: "ALdddddddddddL0" });
newArr.push({ name: "ALdddddddddddL1" });
newArr.push({ name: "ALdddddddddddL2" });
newArr.push({ name: "ALdddddddddddL3" });
var dataItems = { identifier: 'name', label: 'name', items: newArr };
var store = new dojo.data.ItemFileReadStore({ data: dataItems });
dijit.byId('FeatureType').set('store', store);
now it is working.
Nadir,
Glad to help. Now it is your turn to help the community by marking this question as answered. All you have to do is click the "Correct Answer" link (the one with the little green star) on the post that provided the answer for you. If the answer was not provided by one of the responders then you can mark any of the replies that you received as helpful by clicking on the "Actions" menu and choosing "Mark as Helpful"