猿问

我想通过datastore的reload刷新grid的显示方法但是不成功,咋整?

var json =[["a","scpower","dazhou小角","县长","dazhou"],
["b","scpower","dazhou小角","县长","dazhou"],
["c","scpower","dazhou小角","县长","dazhou"],
["d","scpower","dazhou小角","县长","dazhou"]];
var cm= new Ext.grid.ColumnModel(
[{id:'id',header: 'ID', width: 50, dataIndex: 'id'},
{header: '权限类型', width: 90, dataIndex: 'type'},
{header: "权限名称", width: 140, dataIndex: 'name'},
{header: "作用", width: 90, dataIndex: 'value'},
{header: "所属模块", width: 120, dataIndex: 'belong'}]);
cm.defaultSortable = true;
this.ds = new Ext.data.Store({
proxy: new Ext.ux.data.PagingMemoryProxy(this.json),
reader: new Ext.data.ArrayReader({},
[{name:'id'},{name:'type'},{name: 'name'},{name: 'value'},{name: 'belong'}])
});
this.ds.load();
var grid = new Ext.grid.EditorGrid('grid', {
ds: this.ds,
cm: cm
// selModel: new Ext.grid.RowSelectionModel({singleSelect:false})
});
grid.addListener('rowdblclick', function(){rowdblclickFn});

grid.render();

},
rowdblclickFn:function(){
this.json=[["a","scpower","dazhou小角","县长","dazhou"],
["b","scpower","dazhou小角","县长","dazhou"],
["c","scpower","dazhou小角","县长","dazhou"]];
this.json=json;
this.ds.reload();
}
代码不一定能运行 但是大概意思是这个意思 就是要想个方法能购让以前grid的四条数据变成 新的3条其他数据 急 

繁星coding
浏览 227回答 3
3回答

MMTTMM

如果你想加载新的数据要用store.loadData(data)我都说了是通过loadData加载新的数据,真服了你了,还有你那个双击行的方法要不就写在外面,要不就写在grid的listeners,写在那算什么东西

DIEA

this.json=json; == > json = this.json;你在 rowdblclickFn:function() 函数中改变了 this.json的值 但你为何 有把this.json = json;呢?

慕码人2483693

代码不一定能运行 但是大概意思是这个意思 就是要让 reload()方法能购让以前grid的四条数据变成新的3条数据了
随时随地看视频慕课网APP
我要回答