用EXT的editorgridpanel,如何让某一行的某一列为不可编辑呢??

解决方案 »

  1.   

    在editorgridpanel 中写一个监听事件
      

  2.   

    cm = new Ext.grid.ColumnModel({
    columns : [new Ext.grid.RowNumberer(), {
    header : '备注',
    width : 600,
    sortable : true,
    dataIndex : 're'
    }, {
    header : '值',
    width : 150,
    sortable : true,
    dataIndex : 'value',
    editable : true,// 必须默认为true,否则 isCellEditable 没法用
    editor : new Ext.form.TextField({
    allowBlank : true,
    blankText : '',
    selectOnFocus : true,
    maxLength : 200
    })
    }],
    /* 覆盖默认的方法,根据record条件决定是否可以编辑 */
    isCellEditable : function(col, row) {
    var rec = _this_store.getAt(row);
    // var columnIndex =
    // this.findColumnIndex('userName');//可以获得指定名称的列的index
    if (rec.data.canEdit != 1) {
    return false;
    }
    return Ext.grid.ColumnModel.prototype.isCellEditable
    .call(this, col, row);
    }
    });
      

  3.   

    我直接吧这个写在我的代码里?
    /* 覆盖默认的方法,根据record条件决定是否可以编辑 */
    isCellEditable : function(col, row) {
    var rec = _this_store.getAt(row);
    // var columnIndex =
    // this.findColumnIndex('userName');//可以获得指定名称的列的index
    if (rec.data.canEdit != 1) {
    return false;
    }
    return Ext.grid.ColumnModel.prototype.isCellEditable
    .call(this, col, row);
    }
    });
    但是我怎么用?比如我想吧第一行的第2列设为不可编辑,其他可以编辑哦
      

  4.   

    我的EditorGridPanel  ID是:cbgrid,列的id是:amtPtp