Login Register

Dynamically adding items to FilteringSelect

Hello all,

I have a FilteringSelect which I have created from markup like so

<select dojoType="dijit.form.FilteringSelect" id="cmb1">
        <option value="1">aaa</option>
        <option value="2">bbb</option>
        <option value="3">ccc</option>
</select>

and now I want to add an Item dynamically to this list on the click of a button. I have tried the following.

var combo = dijit.byId("cmb1");
combo.store.newItem({text:"ddd", value:"4"}, null);

but I get the error "combo.store.newItem is not a function" in firebug.

Is there any way by which to add items to a FilteringSelect which already contains items created by html markup as above??

I do not want to create a store for the original items and am in urgent need of a solution.
I'd be very grateful for any help/input.

Thanks in advance,
pix.

Dynamically adding items to FilteringSelect

Figured this out.

may be there is a better way, but I changed the store in ComboBox.js from ItemFileReadStore to ItemFileWriteStore, and code change as follows from incorrect: combo.store.newItem({text:"ddd", value:"4"}, null); to correct: combo.store.newItem({name:"ddd", value:"4"}, null);