javascript - 填充dijit表单选择内存存储

javascript - 填充dijit表单选择内存存储,第1张

我试图填充我的dijit / form / select一个内存数据存储区,我已经从我的数据库中返回了json但没有运气。
标记为选择:

<select name="selectMAS" style="width: 150px; height:20px;"
 data-dojo-type="dijit/form/Select" data-dojo-attach-point="selectMAS">
                        </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)
            }
        }

来自DB的json:

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

mhStore已填充,我可以看到数据看起来没问题。我有什么想法可以收到这个错误吗?

由于

最佳答案:

1 个答案:

答案 0 :(得分:0)

我改变了:

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

为:

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

它有效!

本文经用户投稿或网站收集转载,如有侵权请联系本站。

发表评论

0条回复