1

So I have a grid which looks like this

itemId: 'someGrid',
xtype: 'grid',
title: 'Some Grid',
store: 'SomeStore',
selType: 'cellmodel',
plugins: [
   Ext.create('Ext.grid.plugin.CellEditing', {
       clicksToEdit: 2
   })
],
columns: [
                { text: 'column1', dataIndex: 'dataIndex1', flex: 2.7 },
                { xtype: 'checkcolumn', text: column2, dataIndex: 'dataIndex2', flex: 2.7 },
                { xtype: 'checkcolumn', text: column3, dataIndex: 'dataIndex3', flex: 3 },
                { 
                    text: column4, dataIndex: 'dataIndex4', flex: 3.85,
                    editor: {
                        xtype: 'combobox',
                        itemId: 'someCOmbo',
                        store: 'SomeStoreOfCombo',
                        displayField: 'DataName',
                        valueField: 'DataId',
                        allowBlank: false,
                        editable: false,
                    }
                },
                {
                    text: column5, dataIndex: 'dataIndex5', flex: 3,
                    editor: {
                        xtype: 'textfield',
                        allowBlank: false,
                    }
                },
                {
                    text: column6, dataIndex: 'dataIndex6', flex: 3.1,
                    editor: {
                        xtype: 'textfield',
                        allowBlank: false,
                    }
                },
                { text: column7, dataIndex: 'dataIndex7', flex: 1.7 },
                { dataIndex: 'Id', hidden: true }
            ],

both checkcolumns and column4 5 and 6 are editable. I have button under the grid to submit changes. So how do I get all the changed that were made to the grid so that than I can submit it ?

4

1 回答 1

0

这直接编辑,所以你不需要一个按钮:

plugins:[ Ext.create('Ext.grid.plugin.CellEditing',{clicksToEdit: 2, Listeners:[edit: function(editor, e){if (e.value !== e.originalValue) {this.someGrid.getStore().getById(e.record.data.ID).commit();}}]})],

可能需要稍微调整一下,因为我通常使用 Ext.Net 并且只是尝试翻译。但你应该明白它背后的想法;)

如果您希望按钮<store>.sync();用作点击处理程序

(编辑:我不知何故没有让换行符工作 - 有人可以编辑它吗?)

于 2013-07-31T09:27:58.267 回答