【问题标题】:Dojo/Dijit: set entries id attribute in selectDojo/Dijit:在选择中设置条目 id 属性
【发布时间】:2013-04-12 11:29:50
【问题描述】:

我正在尝试使用具有 JsonRest 存储的 dijit\dojo 构建一个

代码是:

var storeEntity = new JsonRest({
    target: contextPath + "/api/myEntity/?param=123",
    identifier : "idEntity"
});

var selectEntity = new Select({
    id: "selectEntity",
    name: "selectEntity",
    style: "width:250px",
    store: storeEntity,
    labelAttr : "someProperty"
}, "selectEntityContainer");

有了这个,我可以设置标签(它可以工作),但我不能设置值的 id,我也不能选择值。 我知道如果我的 Json 具有属性“id”,它会自动作为条目的 id,但是如果我想更改作为 id 的属性,我该怎么做??

【问题讨论】:

    标签: javascript select dojo dijit.form


    【解决方案1】:

    根据API Documentation,您的JsonRest 商店中有一个名为idProperty 的属性。所以应该是:

    var storeEntity = new JsonRest({
        target: contextPath + "/api/myEntity/?param=123",
        idProperty : "idEntity"
    });
    

    【讨论】:

      猜你喜欢
      • 2011-05-12
      • 2012-03-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-11-18
      相关资源
      最近更新 更多