0

We have recently switched from ExtJS 3.2 to 3.4 and found that grids with check box selection model stop working. It turns out that such configuration is not allowed any more:

var gridConfig = {
  xtype: 'grid',            
  store: myStore,
  columns:[ 
    new Ext.grid.CheckboxSelectionModel(), 
  {
    id: 'Name', 
    header: 'Inland Carrier',
    dataIndex: 'Name'
  }],
  sm: new Ext.grid.CheckboxSelectionModel({
    checkOnly: true
  })
};

Instead selection model object must be created once and then passed both to column collection and sm property.

The problem now is that we have a very long configuration object with multitude of grids. Previously selection model was specified locally as per the sample above. But now we have to allot a variable for each selection model object, invent unique name for it, and keep these variables far away from the place where they are used. It's extremely inconvenient.

Is it possible somehow to specify selection model in one place? Or maybe to create it in one property initializer and reference this object in the second place?

Mooh
  • 744
  • 5
  • 25

1 Answers1

0

you can add sm to cm after initialization of grid.

ie:

var gridConfig = {
  xtype: 'grid',            
  store: myStore,
  columns:[{
    id: 'Name', 
    header: 'Inland Carrier',
    dataIndex: 'Name'
  }],
  sm: new Ext.grid.CheckboxSelectionModel({
    checkOnly: true
  })
};
var grid = new Ext.grid.GridPanel( gridConfig );
grid.getColumnModel().config.unshift( grid.getSelectionModel() );
ncank
  • 946
  • 5
  • 15