Reputation: 2204
Why is the first listener not working and the other one working?
How to set the first listener to work?
Maybe the problem is related to scope, this?
How can I set this to see the function available in MainControllers?
It is modern version ExtJS 6.2
Structure folders:
//FeedViewer
//app
//view
//main
/MainController.js
/MainModel.js
/FeedForm.js
/Feeds.js
//classic
//modern
//src
//view
//main
/Main.js
MainController.js:
Ext.define('FeedViewer.view.main.MainController', {
extend: 'Ext.app.ViewController',
alias: 'controller.main',
onNewFeed: function () {
alert('Hello');
}
});
Feeds.js:
Ext.define('FeedViewer.view.main.Feeds', {
extend: 'Ext.grid.Grid',
xtype: 'feedslist',
requires: [
'ContactsApp.view.feeds.MainController',
'ContactsApp.view.feeds.MainModel'
],
viewModel: 'feeds',
controller: 'feeds',
columns: [{
dataIndex: 'feed',
text: 'feed'
}],
items: [{
xtype: 'toolbar',
docked: 'left',
items: [{
xtype: 'button'
text: 'Add New Feed',
iconCls: 'fa fa-plus',
listeners: {
click: 'onNewFeed' * * //It doesn't work**
}
}]
}],
listeners: {
select: 'onNewFeed' * * //It works**
}
});
Upvotes: 1
Views: 67