dojo gridx不会从JSONRest商店读取 - 我在这里缺少什么?

时间:2013-11-27 18:13:43

标签: dojox.grid.datagrid dojox.grid dojo

我无法从JsonRest商店填充gridx小部件。看下面的代码...... test1.json包含与我在teststore数据中指定的信息相同的信息。

当我将网格更改为指向teststore时,它会正确显示内容,但当我将其指向reststore变量时,我会收到“无要显示的项目”消息。

任何人都知道我失踪了什么?

var restStore = new   dojo.store.JsonRest({target:"http://localhost:9081/MyProj/test1.json"});


var teststore = new Store({
 data: [
 {id: "1", "description":"First Description"},
 {id: "2", "description":"Second Description"},
 {id: "3", "description":"Third Description"},
 {id: "4", "description":"Fourth Description"}
       ]
});



  grid = new Grid({
    cacheClass: Cache,
    store: restStore,
    structure: [
      {id: "description", field: 'description', width: '100%'}
    ]
  }); 

grid.startup();

1 个答案:

答案 0 :(得分:0)

gridx和dojox.grid.DataGrid是不是相同的东西。 dojox.grid.DataGrid已弃用,仅适用于旧版dojo /数据存储。您可以使用dojo/data/ObjectStore用dojo / data API包装dojo / store商店:

var teststore = new ObjectStore({ objectStore: new Store({ … }) });

但是,如果您要开始一个新项目,则应该使用dgrid代替它,它本身与dojo / store商店一起使用。

相关问题