Is possible put two view controllers into same folder? I seen many examples but almost all shows how you can create viewController in different namespaces. However when I try put two controllers + views into same folder event failed:
When I did all events in main controller everything works well. However when I wanted add few things, and wanted split Main and Menu into separated controllers, something is wrong.
#1 when is all functionality in MainController, everything works well. However when I put menu to own view and controlller I get error: [E] Ext.util.Event.getFireInfo(): Unable to dynamically resolve method "itemMenuClick"
#2 above error should be fixed with this enrolment. However still think there is better solution.
Code:
main/
main/Main.js
main/MainController.js
main/Menu.js
main/MenuController.js
When I did all events in main controller everything works well. However when I wanted add few things, and wanted split Main and Menu into separated controllers, something is wrong.
Code:
Ext.define('App.view.main.Main', {
extend: 'Ext.container.Container',
controller: 'main',
items: [
{
xtype: 'mainmenu',
reference: 'mainMenu'
}
]
});
Code:
Ext.define('App.view.main.Menu', {
extend: 'Ext.view.View',
alias: 'widget.mainmenu',
controller: 'mainmenu',
initComponent: function () {
var me = this;
...
me.on('itemclick', 'itemMenuClick'); #1
me.on('itemclick', me.getController().itemMenuClick, me.getController()); #2
...
}
});
#1 when is all functionality in MainController, everything works well. However when I put menu to own view and controlller I get error: [E] Ext.util.Event.getFireInfo(): Unable to dynamically resolve method "itemMenuClick"
#2 above error should be fixed with this enrolment. However still think there is better solution.
Thanks for hints.
Aucun commentaire:
Enregistrer un commentaire