I have modular application that contains several modules/plugins, that can also run as standalone applications.
I dynamically register module/plugin controllers to main application and here is the problem in steps.
- My main app has A prefix – its controller” A.controller.AppController.
- My plugin has B prefix – its controller: B.controller.PortalController
Code of plugin controller:
Ext.define('B.controller.PortalController', {
extend: 'Ext.app.Controller',
views: [
'portal.MapPanel',
'administration.ConfigPanel',
'administration.ConfigPanelWrapper'
],
//stores:['Test'],
init: function() {
console.log('portal controller init');
//console.log(this.getTestStore());
this.control({
});
}
});
The views register properly with B prefix, Ext.Loader loads B.view.portal.MapPanel but the store is not loaded.
If I specify stores:['Test'] it tries to load A.store.Test, If I specify test.Test it does nothing (like error but ext-all-debug does not catch it) and if I specify stores:['B.store.Test'] it loads it properly but now I have to use getBStoreTestStore() to get the store reference that will cause a lot of code changing.
How to make the controller to load stores with proper prefix?
Without override I think it is impossible. What is more for my views it should not work also!
All code from
ext-all-debug.jsController loads classess properly using proper prefix using its own classname:
But For each view, store, model its controller creates getter passing name into getStore, getView, getModel function
The getStore function that getter is passed into returns application store:
Application itself uses getModuleClassName to resolve class name
So if there is fully qualified class name with known prefix it will return name only otherwise class name will be built using
this.namewhich is application name so usingstores:['Test']will point toA.store.Test.I am thinking about writing an override but I am afraid that it will break other things.