fill dijit form select with memory store

618 views Asked by At

I'm trying to fill my dijit/form/select with a memory datastore that I've filled with json returned from my database and not having any luck.
Markup for select:

<select name="selectMAS" style="width: 150px; height:20px;"
 data-dojo-type="dijit/form/Select" data-dojo-attach-point="selectMAS">
                        </select>

code to fill the select:

GetMASConfirm: function (data, msg) {
            //returned data from database
            if (msg == "ok") {
                var mhStore = new Memory({ data: data, idProperty: "MHID" });
                //var os = new ObjectStore({ objectStore: mhStore });//tried os as datastore, no error, but values in select are just lines
                this.selectMAS.set("label", "MHID");
                this.selectMAS.set("store", mhStore);//TypeError: c.getLabel is not a function
            }
            else {
                alert(msg)
            }
        }

the json from DB:

[{"MHID":"4A-0010","x":-13096156.249100,"y":4014364.281600},{"MHID":"4A-0020","x":-13096182.952400,"y":4014712.019600}]

mhStore is populated and I can see the data looks ok. Any ideas why I'm getting this error?

Thanks

1

There are 1 answers

0
pvitt On

I changed:

this.selectMAS.set("label", "MHID");

to:

this.selectMAS.set("labelAttr", "MHID");

and it worked!