Dojo Combobox run time problem

3609
3
Jump to solution
05-22-2015 04:13 PM
NadirHussain
Occasional Contributor II

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.

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

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);

View solution in original post

0 Kudos
3 Replies
RobertScheitlin__GISP
MVP Emeritus

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);

0 Kudos
NadirHussain
Occasional Contributor II

<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.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

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"

0 Kudos