3
votes

I am unable to select multiple rows dynamically for grid having Ext.selection.CheckboxModel.

I have indexes for the rows which I want to select. What is happening is after select call.

for(var i=0;i<count;i++){
Ext.getCmp('loadFrameStateInfoTable').getSelectionModel().select(oldStateSelection[i].index);
}

I got the selection in grid but for only one row. That's the row which index is coming last from oldStateSelection[i].index.

The grid should have all rows selected.

2

2 Answers

3
votes

As you can see in the docs, you need to set keepExisting if you don't want the other lines deselected.

select(oldStateSelection[i].index, true);
0
votes

Here is the new method for ExtJS 6.2.0 and higher:

.getSelectionModel().select(i,true) - worked for me. Here I record the index.

Method documentation:

select ( records, [keepExisting], [suppressEvent] ) Selects a record instance by record instance or index.

PARAMETERS

  • records : Ext.data.Model[]/Number An array of records or an index
  • keepExisting : Boolean (optional) True to retain existing selections; Defaults to: false
  • suppressEvent : Boolean (optional) True to not fire a select event; Defaults to: false