2013-07-31 39 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

(編輯:我有點不明白換行的工作 - 有人可以請編輯)