【发布时间】:2012-05-07 22:15:25
【问题描述】:
我有一个带有复选框选择模型的网格。我想根据网格的数据存储预先选择复选框。谁能帮帮我?
【问题讨论】:
我有一个带有复选框选择模型的网格。我想根据网格的数据存储预先选择复选框。谁能帮帮我?
【问题讨论】:
可以使用 store 的 'load' 事件和 RowSelectionModel 对象的 'selectRows' 方法来选择行。
var grid = new Ext.grid.GridPanel(...
sm:new Ext.grid.RowSelectionModel(),..);
var store = new Ext.data.JsonStore(...);
store.on('load',function(records){
Ext.each(records,function(record){
//here you construct an array of row numbers in the grid that you want to select, based on the records you just loaded into the store , let the array be 'rows'
grid.getSelectionModel.selectRows(rows);
})
});
【讨论】: