grid控件从后台读取数据,根据后台数据显示数据集,有的数据行前面的checkbox默认被勾选,我现在现实现的是,被勾选的数据行变为灰色不可用的状态。怎么实现?????????

解决方案 »

  1.   

    重写一下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);
            }    }
    });