I want to add views and stores in controller dynamically. So, I've had this:
Ext.define('App.controller.MyController', {
extend: 'Ext.app.Controller',
stores: ['App.store.Users'],
views: ['App.view.Users.Index'],
I'm creating this controller dynamically with:
var controller = this.getController("Users");
How can I add store and views dynamically, something like:
var controller = this.getController(moduleID);
controller.stores = [];
controller.views = [];
controller.stores.push('App.store.Users');
controller.views.push('App.view.Users.Index');
But when I do that, it's not working. Console is telling me that Ext can't get "buffered from undefined" so I'm thinking that I have to do this with Ext.apply()
or Ext.merge()
or something like that to get getters
and setters
for stores
.
What do you think?
EDIT for @asgoth:
When you use this.getController("nameOfController");
and if the controller doesn't exists, Ext-JS creates one for you. That's working 100% because when I console.log(controller);
I'm getting data (and docs says that too). :)