Help! I have an ExtJS 4.2 MVC application that will contain multitudes of various Views. However, each user will have access to a mere fraction of the entire set. Obviously I don't want to load all of the Views for every user! Furthermore, each 'allowed' view should be loaded after the user has signed in.
In the past (before MVC) I used Ext.create() to dynamically load my .js class files. However, I'm trying to use the MVC design pattern and everything I've read online suggests that this seems to be a limitation of ExtJS 4.2 MVC. Is this true? Below is what I have tried so far.
First, the custom view definition (a basic container example):
Ext.define('My.custom.TestView', {
extend: 'Ext.container.Container',
alias: 'widget.myCustomTestView',
html: 'Test',
initComponent: function() {
this.callParent(arguments);
}
});
Second, the controller definition that's trying to load/instantiate the custom view:
Ext.define('My.custom.TestController', {
extend: 'Ext.app.Controller',
// Empty array because I want to
// add views during run-time.
views: [
],
init: function () {
// Attempt #1: This produces an error.
this.getView('My.custom.TestView').create();
// Attempt #2: This returns null.
Ext.widget('myCustomTestView');
// Attempt #3: This appears it might work, but it's ugly!
Ext.create('My.custom.TestView');
this.getView('My.custom.TestView').create();
}
});
While #3 is the only one that does not give errors, it does not look right to me. Any suggestions/comments?