2013-05-04 71 views
4

背景ExtJS的4控制器網格編輯更改事件

我有一個可編輯的網格,以及管理網格控制器。我想監聽所有網格編輯器的更改事件,並在網格沒有任何空行時添加新行。

問題

我似乎無法聽通過控制電網的編輯更改事件。這是我的代碼。

InvoiceController

電網

Ext.define('MyApp.view.InvoiceItemsGrid', { 
    extend: 'Ext.grid.Panel', 
    alias: 'widget.invoice_items_grid', 

    requires: [ 
     'MyApp.view.ProductCombo', 
     'MyApp.view.AccountCombo', 
     'MyApp.view.TaxRateCombo' 
    ], 

    frame: true, 
    bodyBorder: true, 
    title: 'Invoice Items', 
    columnLines: true, 
    forceFit: true, 
    store: 'InvoiceItem', 

    initComponent: function() { 
     var me = this; 

     Ext.applyIf(me, { 
      columns: [ 
       //... 
       { 
        xtype: 'gridcolumn', 
        maxWidth: 100, 
        minWidth: 80, 
        width: 100, 
        dataIndex: 'product_id', 
        text: 'Product ID', 
        editor: { 
         xtype: 'product_combo', 
         actiuon: 'update' 
        } 
       } 
       //... 
      ], 
      viewConfig: { 
       plugins: [ 
        Ext.create('Ext.grid.plugin.DragDrop', { 

        }) 
       ] 
      }, 
      plugins: [ 
       Ext.create('Ext.grid.plugin.CellEditing', { 
        clicksToEdit: 1 
       }) 
      ] 
     }); 

     me.callParent(arguments); 
    }, 

}); 

我能聽網的編輯事件,並添加新行,問題與使用網格編輯事件是編輯失去焦點後編輯器內容發生變化時事件就會消失,這不會產生我想要的行爲。

'invoice_items_grid': { 
    edit: this.addBlankInvoiceItem 
}, 

問題 我怎麼聽通過控制器上的網格中的每個編輯的更改事件?

回答

2

你在你的網格編輯器配置有一個錯字有

actiuon: 'update' 

應該是:

action: 'update'