Hi there,
I'm experiencing a issue with getSelectionModel() and deselectRow().
I have a grid with a RowSelectionModel. There's one button to delete selected rows.
But before to delete the row, I have to check is one field in record.data is not equal to a certain value. Regarding this, I allow or not to delete the row, and deselect the row if not allowed.
PHP Code:
,delRoom:function(p){
p.getSelectionModel().each(function(item,index){
if(item.data.parent_id==1||item.data.r_room_id==1){
Ext.ux.Toast.msg(__('shared.popup.avertissement'),__('travel.popup.roomError'));
p.getSelectionModel().deselectRow(index);
}
},this);
return true;
}
The thing is getSelectionModel().each() returns the index of the row inside the selection, and to deselect a row you need the index of the row inside the grid
So as you can see, my function doesn't work, because I don't use the good index to deselect a row.
I don't know how to make the two indexes match.
Which method could I use from Ext.grid.GridPanel or Ext.grid.RowSelectionModel to make it work?
Thanx in advance,
_bertrand