Ext JS EditorGridPanel不可编辑

时间:2010-03-01 21:34:54

标签: javascript extjs

我正在尝试修改此示例:http://www.extjs.com/deploy/dev/examples/writer/writer.html以使网格中的所有字段都可编辑(目前只有一个字段)。

我已尝试在UserGrid.js(第118-120行)中注释掉这些行:

//this.stopEditing();
this.store.insert(0, u);
//this.startEditing(0, 1);

但是,这只会将您可以编辑的字段更改为您尝试编辑的第一个字段。

如何使整个网格可编辑?

1 个答案:

答案 0 :(得分:5)

http://www.extjs.com/deploy/dev/examples/writer/writer.js替换

var userColumns =  [
    {header: "ID", width: 40, sortable: true, dataIndex: 'id'},
    {header: "Email", width: 100, sortable: true, dataIndex: 'email', editor: textField},
    {header: "First", width: 50, sortable: true, dataIndex: 'first', editor: textField},
    {header: "Last", width: 50, sortable: true, dataIndex: 'last', editor: textField}
];

var userColumns =  [
    {header: "ID", width: 40, sortable: true, dataIndex: 'id'},
    {header: "Email", width: 100, sortable: true, dataIndex: 'email', editor: new Ext.form.TextField()},
    {header: "First", width: 50, sortable: true, dataIndex: 'first', editor: new Ext.form.TextField()},
    {header: "Last", width: 50, sortable: true, dataIndex: 'last', editor: new Ext.form.TextField()}
];