@cmadison0005
We encountered a similar issue in our controllers recently. Though we are not doing the dynamic loading of the controllers at the Ext.application level as you are. In our custom routing we lookup the controller and fire the init().
What we did to get around all the duplicate events, rather than say clearing all the event listeners in init(), was we moved the this.control() into the onLaunch() event. As init() is called when your application boots up, and the onLaunch() is kind of like init(), but called after the viewport is created.
Code:
Ext.define('App.controller.Search', {
extend: 'Ext.app.Controller',
views: [
'transaction.Search'
],
// Called when your application boots.
init: function(app) {
console.log('App.controller.Transaction.Search init');
},
// Like init, but called after the viewport is created.
onLaunch: function(app){
console.log('App.controller.Transaction.Search onLaunch');
this.control({
'transaction-search tool[action=help]': {
click: this.onHelpClick
}
});
},
index: function(){
console.log('App.controller.Transaction.Search index');
this.render('transaction.Search');
},
onHelpClick: function(btn) {
Ext.Msg.show({
title: 'Help Text',
msg: 'Lorem ipsum dolor set amet.',
buttons: Ext.Msg.OK,
icon: Ext.Msg.QUESTION
});
}
});