Can some one pls tell me how to update data grid using a json object. My data grid is created as beleow.
var grid4 = new dojox.grid.DataGrid({
query : {
number: '*'
},
clientSort : true,
rowSelector : '20px',
structure : layout4
}, document.createEle开发者_运维问答ment('div'));
grid4.setStore(jsonStore);
dojo.byId("gridContainer4").appendChild(grid4.domNode);
grid4.startup();
initially jsonStore applies to the grid without any problem. But later I get json object something similar to following.
data = {
"results" : {
"info" : [{
"number" : "12.11",
"product" : "KALA,
"Qty" : "0.00" }]
}
}
So I need to apply these data to my grid. I dont know how to do it can some one plese help me to data. Thanks in advance.
The store should contain the "data" key, as you correctly did, and the corresponding object should have the "items" key. Have a look also at my answer here: Dojo grid nested json
You can add new items to the grid by adding the item to the underlying data store :
grid.store.newItem(jsonItem);
grid.store.save()
精彩评论