ExtJs ExtenderControl 勾选列处理

 在ExtJs ExtenderControl 中添加勾选列后,不能正常勾选,因为每一次单击勾选框的操作都会都单击行的覆盖。
这时,我们需要在选择时,监听选择事件,并处理,即可。代码如下:

     sm = new Ext.grid.CheckboxSelectionModel({
        listeners: {
          beforerowselect : function (sm, rowIndex, keep, rec) {
            if (this.deselectingFlag && this.grid.enableDragDrop){
              this.deselectingFlag = false;
              this.deselectRow(rowIndex);
              return this.deselectingFlag;
            }

            return keep;
          }
        },
        onMouseDown : function(e, t){
            if(e.button === 0 ){
                e.stopEvent();
                var row = e.getTarget('.x-grid3-row');
                if(row){
                    var index = row.rowIndex;
                    if(this.isSelected(index)){
                        if (!this.grid.enableDragDrop)
                          this.deselectRow(index);
                        else
                          this.deselectingFlag = true;
                    }else{
                        this.selectRow(index, true);
                    }
                }
            }
        }
    });

posted on 2008-05-11 18:50  舒密  阅读(1464)  评论(0编辑  收藏  举报

导航