PDA

View Full Version : conditional checking on Check All



raj_plays
21 Jan 2011, 11:34 PM
Hi,
I have a GridPanel with a CheckboxSelectionModel.
I need to modify the behaviour of the Select All checkbox.
When that is checked, I want only certain records to be selected based on the store data.
Something like..
if (record.data.inbound == 1)
then select the record
else
do not select

How can I achieve this?

Condor
22 Jan 2011, 1:19 AM
You'll have to override the selectAll method, e.g.

var selModel = new Ext.grid.CheckboxSelectionModel({
selectAll : function(){
if(this.isLocked()){
return;
}
this.selections.clear();
for(var i = 0, len = this.grid.store.getCount(); i < len; i++){
if (this.grid.getStore().get('inbound') == 1) {
this.selectRow(i, true);
}
}
}
});

raj_plays
22 Jan 2011, 7:59 AM
Thank you, Condor