extjs
gridpanel 中有一列是 checkboxselectionModel()
我想在初始化gridpanel的store的时候
根据 数据库中一列的值
来设置(初始化) gridpanel 中的checkbox是否被选中
=====================
这个要在你给 Grid 绑定的 Store 的 load 事件中做。
举例如下:
var selModel = new Ext.grid.CheckboxSelectionModel(); //你的 Checkbox 选择器定义
var dataStore = new Ext.data.JsonStore({
//...
//这儿是你的 dataStore 的具体定义
//...
listeners: {
load: function(store) {
var index = 0;
store.each(function(record) {
if(record.data.column_name == '1') { //column_name 替换成你的列名, '1' 替换成你的值
selModel.selectRow(index);
}
index++;
})
}
}
});
gridpanel 中有一列是 checkboxselectionModel()
我想在初始化gridpanel的store的时候
根据 数据库中一列的值
来设置(初始化) gridpanel 中的checkbox是否被选中
=====================
这个要在你给 Grid 绑定的 Store 的 load 事件中做。
举例如下:
var selModel = new Ext.grid.CheckboxSelectionModel(); //你的 Checkbox 选择器定义
var dataStore = new Ext.data.JsonStore({
//...
//这儿是你的 dataStore 的具体定义
//...
listeners: {
load: function(store) {
var index = 0;
store.each(function(record) {
if(record.data.column_name == '1') { //column_name 替换成你的列名, '1' 替换成你的值
selModel.selectRow(index);
}
index++;
})
}
}
});