Ext.override(Ext.grid.GridView,{
onRowSelect : function(row){
this.addRowClass(row, "x-grid3-row-selected");
var selected = 0;
var len = this.grid.store.getCount();
for(var i = 0; i < len; i++){
var r = this.getRow(i);
if(r){
if( this.fly(r).hasClass('x-grid3-row-selected'))selected = selected + 1;
}
}
var hd = this.grid.getEl().select('div.x-grid3-hd-checker').first();
if (selected == len && !hd.hasClass('x-grid3-hd-checker-on')) {
hd.addClass('x-grid3-hd-checker-on');
}
},
onRowDeselect : function(row){
this.removeRowClass(row, "x-grid3-row-selected");
var selected = 0;
var len = this.grid.store.getCount();
for(var i = 0; i < len; i++){
var r = this.getRow(i);
if(r){
if( this.fly(r).hasClass('x-grid3-row-selected'))selected = selected + 1;
}
}
var hd = this.grid.getEl().select('div.x-grid3-hd-checker').first();
if (selected != len && hd.hasClass('x-grid3-hd-checker-on')) {
hd.removeClass('x-grid3-hd-checker-on');
}
}
});
重写源代码即可实现功能