我的代码
myStore = dojo.store.Cache(dojo.store.JsonRest({
target : "myip7080/GridExample/string"
}), dojo.store.Memory());
myStore.query({
start: 0,
count: 1000
}).then(function(results){
alert(results);
});
grid = new dojox.grid.DataGrid({
store : dataStore = dojo.data.ObjectStore({
objectStore : myStore
}),
structure : [ {
name : "SNO",
field : "sno",
width : "100px",
editable : true
}, {
name : "SNAME",
field : "sname",
width : "100px",
editable : true
}, {
name : "SALARY",
field : "salary",
width : "200px",
editable : true
} ]
}, "target-node-id"); // make sure you have a target HTML element with this id
grid.startup();
dojo.query("#save").onclick(function() {
dataStore.save();
});
});
答案 0 :(得分:0)
dojo/store/Memory::query()
有两个参数:
您可以通过以下方式查询数据中的特定条目:
myStore.query(
{ name: "John Doe" }
);
//returns all rows with name="John Doe"
您没有拥有来进行特定查询。如果您需要所有数据,请执行myStore.query("");
如果要限制显示的行数,则需要添加第二个参数来表示查询选项:
myStore.query(
{ name: "John Doe" },
{ start: 0, count: 1000 } //return 1000 results, starting at the beginning
);