0

这与已经发布的问题非常相似http://www.sencha.com/forum/showthread.php?245591

这是我的 Grid 代码(请注意,在网格中声明的注释监听器工作正常)

Ext.define( 'Fast.view.sales.SalesForecastDealersGrid ' ,{
    extend: 'Ext.grid.Panel',
    alias : 'widget.SalesForecastDealersGrid' ,
    selModel: Ext.create( 'Ext.selection.CheckboxModel' ),// sm,
    requires:[ 'Ext.toolbar.Paging'],
    columnLines: true,
    store: 'sales.SalesForecastDealers', //'sales.ProductByAccount',

    columns: [{text: 'Dealer Id',hidden: true ,flex:1,dataIndex:'dealerId' },
              {text: 'Customer Name',flex:1,sortable: true,dataIndex: 'dealerName' },
              {text: 'Sales Ids',hidden: true,flex:1,sortable: false ,dataIndex:'salesIds' }],

       initComponent: function () {

        this .dockedItems = [
        {
            xtype: 'pagingtoolbar' , dock:'bottom' ,
            store: 'sales.SalesMonthFct' ,//localStore,
            displayInfo: true ,
            displayMsg: 'Displaying ProductByAccount {0} - {1} of {2}' +'&nbsp &nbsp &nbsp',
            emptyMsg: "No ProductByAccount to display"
        }];
        this .callParent(arguments);
       } /*,
listeners:{
        selectionchange : function(model, records) {
       // var records = grid.getSelectionModel().getSelection();
       alert('section changed handler');
    }}*/    

}); 

和控制器

Ext.define( 'Fast.controller.sales.SalesForecastController', {
    extend: 'Ext.app.Controller',

    stores: ['sales.SalesWeekFct' ,'sales.SalesMonthFct' ,'sales.SalesForecastDealers' ],
    models: [ 'sales.SalesWeekFctModel', 'sales.SalesMonthFctModel' ],
    views: ['sales.SalesForecastWeeklyGrid' ,'sales.SalesForecastMonthlyGrid' ,'sales. SalesForecastDealersGrid' ],
    refs: [{ref: 'SalesForecastWeeklyGrid',selector: 'SalesForecastWeeklyGrid' }
          ,{ref: 'SalesForecastMonthlyGrid' ,selector: 'SalesForecastMonthlyGrid' }
          ,{ref: 'SalesForecastDealersGrid ',selector: 'SalesForecastDealersGrid '}
          ],

       init: function () {
    this .control({
    //'SalesForecastDealersGrid [action=change]': {selectionchange: this.dealerSelectionChange},
    'SalesForecastDealersGrid ': {selectionchange: this .dealerSelectionChange}
    });
    },

    dealerSelectionChanged : function (model, records) {
    //var records = grid.getSelectionModel().getSelection();
       alert( 'Controllers section changed handler' );
    }
});

正如您所注意到的,我已经评论了“'SalesForecastDealersGrid [action=change]':{selectionchange : this.dealerSelectionChange}”行,因为我找不到任何关于“[action=change]”的文档,而且它根本不会触发在我的情况下任何事情。

当我单击网格行时使用我的代码,我在控制台中收到一条错误消息

TypeError: listener.fireFn is undefined
...listener && listener.fireFn.apply(listener.scope || me.observable, args) === fal...

知道接下来我可以尝试什么吗?

先感谢您。

4

1 回答 1

0

您的控制器没有功能:

selectionchange: this .dealerSelectionChange

因为您的函数名称是:

dealerSelectionChanged : function (model, records)
于 2013-07-12T03:09:24.507 回答