当前位置: 代码迷 >> Web前端 >> Ext.grid.CheckboxSelectionModel 修理 checkbox bug
  详细解决方案

Ext.grid.CheckboxSelectionModel 修理 checkbox bug

热度:410   发布时间:2012-11-23 22:54:33.0
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');
??? }
?});?
}

  相关解决方案