0

在 extjs 4.1.1 中编辑时如何禁用行的特定单元格?我正在使用网格编辑器。我有一个网格,它有 2 列,名称和年龄。单击编辑时,我必须禁用名称字段,用户只能编辑年龄。

4

2 回答 2

1

如果您只能使用行编辑器进行编辑,则不要在列上指定编辑器配置。如果您也可以添加,那么您可以尝试以下操作(我自己从未做过,但应该可以):

grid.on('beforeedit', function(editor, e, eOpts) {
     // if editing.. 
     this.down('column[dataIndex=name]').setEditor(null);
     // else
     this.down('column[dataIndex=name]').setEditor(/* editor config */);
}, grid);
于 2012-12-10T13:15:17.210 回答
0

你可以用这个

grid.on('beforeedit', function(editor, e, eOpts) {
         // if editing.. 
         if(e.field == "name"){
               e.cancel = true;  
          }
    });

将 e.cancel 设置为true 将禁用该字段的编辑。

于 2016-05-10T14:18:13.180 回答