Extjs中怎么获取grid控件中的行对象

解决方案 »

  1.   

    就是将整行灰掉,看上去为不可用状态。
    你昨天给我的代码不管用,因为我的表格选择模型不是rowSelectionModel
    Ext.override(Ext.grid.RowSelectionModel, {
        selectRow: function(index, keepExisting, preventViewNotify) {
            if (this.isLocked() || (index < 0 || index >= this.grid.store.getCount()) || (keepExisting && this.isSelected(index)) || (Number(this.grid.store.getAt(index).get("Flag")) === 0)) {//给一个标识来确定哪一行不能选择
                return;
            }
            var r = this.grid.store.getAt(index);
            if (r && this.fireEvent('beforerowselect', this, index, keepExisting, r) !== false) {
                if (!keepExisting || this.singleSelect) {
                    this.clearSelections();
                }
                this.selections.add(r);
                this.last = this.lastActive = index;
                if (!preventViewNotify) {
                    this.grid.getView().onRowSelect(index);
                }
                this.fireEvent('rowselect', this, index, r);
                this.fireEvent('selectionchange', this);
            }    }
    });
      

  2.   

    grid用这个模型
    var CheckBoxColumn = new Ext.grid.CheckboxSelectionModel();
      

  3.   


    我没用这个模型,用的默认的列模型。前面的复选框是我组件写的css脚本控件的,因为我的复选框选中状态用3种形式,Ext的CheckboxSelectionModel满足不了我的要求,所以自己写了个......