与已发布的问题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}' +'     ',
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...
知道我接下来可以尝试什么吗?
提前谢谢。
答案 0 :(得分:0)
您的控制器没有功能:
selectionchange: this .dealerSelectionChange
因为您的函数名称是:
dealerSelectionChanged : function (model, records)