2

I have a grid with a checkbox selection model. I want to preselect the checkboxes based on the data store for grid. Can anyone please help me out?

spv
  • 75
  • 1
  • 9

1 Answers1

0

The rows can be selected by using the 'load' event of the store and the 'selectRows' method of the RowSelectionModel object.

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); 
     }) 
});
Alin Suciu
  • 121
  • 2