2013-07-31 30 views
1

的编辑栏所以我有一个grid它看起来像这样提交电网的Ext JS

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 } 
      ], 

两个checkcolumnscolumn4 5和6是可编辑的。我有网格下的按钮来提交更改。那么,如何才能将所有对网格所做的更改都提交给我?

+0

?你在这个问题上还需要帮助吗?你只是想知道如何获得标记为已更改的记录吗? – Reimius

回答

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();函数clickhandler

(编辑:我有点不明白换行的工作 - 有人可以请编辑)