Is it possible to dynamically load a "self MVC" component:
Code:
/* Tree Hierarchy:
*
* app/
* controller/
* menu/
* MainMenu.js
* model/
* menu/
* MainMenu.js
* store/
* menu/
* MainMenu.js
* view/
* menu/
* MainMenu.js
* core/
* PluginManager.js
* app.js
* index.html
/* In app.js */
ALWA = Ext.create('ALWA.App', {
enableDebug: true,
name: 'ALWA',
controllers: [],
models: [],
stores: [],
views: [],
/*
* start application
*/
launch: function() { }
});
/* In PluginManager.js */
...
var menu = 'menu.MainMenu';
ALWA.app.controllers.push('ALWA.controller.' + menu);
ALWA.app.models.push('ALWA.model.' + menu);
ALWA.app.stores.push('ALWA.store.' + menu);
ALWA.app.views.push('ALWA.view.' + menu);
var controller = ALWA.app.getController('ALWA.controller.' + menu);
/* This does not work.
* It says 'no init function defined'
*/
Ext.each(ALWA.app.controllers, function(c, i) {
c.init();
});
/* I want to create the view dynamically with all the associated:
controller,
model,
store
view */
/* Please HELP */