假设我有以下内容:
var data = {
identifier: "pkid",
items: [ {pkid: 3456, name: "Tom", kids: [ {pkid: 3459, kidname: "Jenny"}, {pkid: 45698, kidname: "Jimmy"} ]
}
var mainStore = new ItemFileWriteStore({data: data});
var mainGrid = new var grid = new dojox.grid.DataGrid({
id: 'grid',
store: store,
structure: layout,
rowSelector: '20px'},
document.createElement('div'));
/*append the new grid to the div*/
dojo.byId("maingridDiv").appendChild(grid.domNode);
/*Call startup() to render the grid*/
grid.startup();
我如何从数据存储中删除pkid:45698标识的孩子,如果它显示的是那个孩子,它应该反映在网格中,而不应该再显示了?
基本上,您只需要var kids=store.getValues(parent,"kids");然后,你需要确定你要找的孩子在哪个索引上,然后存储.setValues(parent,"children",kids.splice(indexOfKid,1));诸如此类的事情。