`

Ext. GridPanel中选中单元格时,不需要按ctrl键便可多选

 
阅读更多

 Ext GridPanel中选中单元格时,不需要按ctrl键便可多选

 

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);     

        }     

      }     

    }   

});   

 

  var grid = new Ext.grid.GridPanel({

el : 'mygrid',

ds : ds,

cm : cm,

sm:new Ext.grid.CheckboxSelectionModel(),

id:'vehicleGrid', 

selModel: new Ext.grid.RowSelectionModel(),

bodyStyle : screenHight,

bbar : new Ext.PagingToolbar( {

id : 'pagingBar',

height : 30,

plugins : new Ext.ux.Andrie.pPageSize(),

store : ds

})

});

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics