单选复选框区域外一行,已选行不会反选

//S 重写CheckBoxSelectionModel的handleMouseDown事件。单选复选框区域外一行,已选行不会反选        

  Ext.override(Ext.grid.CheckboxSelectionModel, { 

          handleMouseDown : function(g, rowIndex, e){                  

               if(e.button !== 0 || this.isLocked()){                      

                        return;                  

                }                  

              var view = this.grid.getView();                  

              if(e.shiftKey && !this.singleSelect && this.last !== false){                      

                 var last = this.last;                      

                this.selectRange(last, rowIndex, e.ctrlKey);                      

                this.last = last; // reset the last                      

                 view.focusRow(rowIndex);                  

                }                

              else  {                      

                  var isSelected = this.isSelected(rowIndex);                      

                  if(isSelected){                          

                        this.deselectRow(rowIndex);                      

                    }                    

                  else if(!isSelected || this.getCount() > 1){                          

                         this.selectRow(rowIndex, true);                          

                        view.focusRow(rowIndex);                      

                    }                  

                  }                  

              }          

            });     

//E 重写CheckBoxSelectionModel的handleMouseDown事件。单选复选框区域外一行,已选行不会反选      

posted @ 2012-02-21 14:01  赤卫  Views(203)  Comments(0)    收藏  举报