[Dojo-interest] Error adding object to store

John Daly jdaly at panix.com
Wed Jun 11 12:36:49 EDT 2014


I have a Memory store wich is wrapped with Observable and Cache, and
setting the store of a dijit Select widget with this data. All displays
well, but what I want to do is add and remove values from this store
during the onClick event and have the store reflect the changes.  I am
getting errors in the process.  Code:

function (parser, registry, domConstruct, array, request, Select,
ObjectStore, Memory, JsonRest, Observable, Cache) {

        var memoryStore = new Observable(new Memory({}));
        var restStore = new JsonRest({ target:  "../getClaimsJSON.ashx?mode=init&ent=dept" });

        var store = new Cache(restStore, memoryStore);

        var s = new Select({
           store: store,
           labelAttr: "label",
           style: "width:200px;"
        }, "deptDropDown");


        s.on("click", function () {
           store.put({ "id": "2000", "label": "foo" });

           store.query().forEach(function (department) {
              console.log(department.id + " " + department.label);


error: TypeError: invalid 'in' operand object
Line 70

I saw this was listed as a bug but that it was also resolved.   Any

Dojo Version: 1.9.3 (fd52c96)

Thank you to Deepak Anand for feedback on the Select widget problem.
Turns out it was throwing an error because I failed to provide the
"labelAttr" property.



More information about the Dojo-interest mailing list