以下是详细信息:
提前致谢!!!
答案 0 :(得分:4)
在Ext JS 4.2.1中运行的经过测试的代码:
grid.on('viewready', function(){
grid.selModel.doSelect(grid.store.data.items[0]);
});
答案 1 :(得分:2)
总是欢迎更好的解决方案!!!
grid.getStore().load({
scope:this,
callback: function (records, operation, success) {
if(success){
/*var store = grid.getStore();
var records = [];
store.queryBy(function(record,id){
if(record.data.chkd){
records.push(record);
}
console.log(id);
},this);
grid.getSelectionModel().select(records,false,false);
*/
var sm = grid.getSelectionModel();
Ext.each(records, function(record) {
if(record.data.chkd){
var row = record.index;
sm.select(row, true);
}
});
}else{
//alert(success);
//console.log(operation.exception);
}
}}
);