-3

这是详细信息:

http://www.sencha.com/forum/showthread.php?194117-how-set-selected-row-in-default-when-load-gridpanel-using-checkbox-selection-model

提前致谢!!!

4

2 回答 2

4

在 Ext JS 4.2.1 中工作的测试代码:

grid.on('viewready', function(){
    grid.selModel.doSelect(grid.store.data.items[0]);
});
于 2013-09-10T15:30:43.427 回答
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);
    }
}}
);
于 2013-04-03T09:34:00.930 回答