PDA

View Full Version : CheckboxSelectionModel deselect column header checkbox



ttbgwt
12 Aug 2009, 10:16 AM
I'm using the CheckboxSelectionModel on my grid and can call grid.getSelectionModel().clearSelections() and it will clear all of the selected rows but it will not clear out the header checkbox. The column header checkbox stays checked. How can I clear the column header checkbox?

Thanks!

dsuzette
1 Sep 2009, 7:21 AM
I extended Ext.grid.CheckboxSelectionModel and added a selectionchange listener. I got this from an older thread and changed is a little, my changes are in green:
http://extjs.com/forum/showthread.php?t=50266



MyApp.CheckboxSelectionModel = Ext.extend(Ext.grid.CheckboxSelectionModel,{
listeners: {
'selectionchange': function() {
var hd = Ext.fly(this.grid.getView().innerHd).child('div.x-grid3-hd-checker');
//Remove the checked class if store is empty or all items not checked
if ( (this.grid.getStore().getCount() === 0) || (this.getCount() < this.grid.getStore().getCount()) ) {
hd.removeClass('x-grid3-hd-checker-on');
} else {
hd.addClass('x-grid3-hd-checker-on');
}
}
}
});

jocampo
2 Sep 2009, 12:46 PM
@dsuzette

I am not understand a lot about "extends", could you help me? where i should put your codo in order to make it work?!

Thnaks in advance