首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

Ext.grid.CheckboxSelectionModel 修理 checkbox bug

2012-11-23 
Ext.grid.CheckboxSelectionModel 修复 checkbox bug全选和取消选择的控制,扩展CheckboxSelectionModel即

Ext.grid.CheckboxSelectionModel 修复 checkbox bug

全选和取消选择的控制,扩展CheckboxSelectionModel即可, 对JS语法不太熟悉,琢磨了好久才完成.

Merry Christmas!?

if (Ext.grid.CheckboxSelectionModel) {
?var interceptOnMouseDown = Ext.grid.CheckboxSelectionModel.prototype.onMouseDown.createInterceptor(function(e, t){
???this.on('rowdeselect', this.handleDeselect, this);
???this.on('rowselect', this.handleSelect, this);???
??}?
?);
?
?Ext.override(Ext.grid.CheckboxSelectionModel, {
??hd : null,?? ??
??? onMouseDown : interceptOnMouseDown,?????
??? handleSelect:function(){
????? if(this.grid.store.getCount()!=this.selections.length)
????return;?
??? var hd = Ext.fly(this.grid.getView().innerHd).child('div.x-grid3-hd-checker');
????? if(!hd.hasClass('x-grid3-hd-checker-on'))??
??? ??hd.addClass('x-grid3-hd-checker-on');
??? },???
??? handleDeselect:function(){
??? ? if( this.grid.store.getCount() != this.selections.length +1)
????return;?
????? var hd = Ext.fly(this.grid.getView().innerHd).child('div.x-grid3-hd-checker');?
????? if(hd.hasClass('x-grid3-hd-checker-on'))
??? ?? hd.removeClass('x-grid3-hd-checker-on');
??? }
?});?
}

热点排行