bweiler
30 Jan 2012, 10:58 AM
I have been using the following get[ViewName]View() approach to get references to view constructors and I understand this will be changing going forward. In fact, if the views array is moved to the application definition, this old approach no longer works.
Old approach:
Ext.define('MyApp.controller.MyController', {
extend: 'Ext.app.Controller',
views: [
'MyList' // May belong in the app definition
],
var list = this.getMyListView().create();
...
Please explain the proper way to create and reference views going forward. I tried the following approach and it did not work.
Ext.define('MyApp.controller.MyController', {
extend: 'Ext.app.Controller',
views: [
'MyList' // Does the views array belong in the app definition?
],
refs: {
// It made sense to me to autoCreate the main
main: {
selector: 'mainview',
xtype: 'mainview',
autoCreate: true
},
// Do I have to autoCreate all views?
myList: 'mylistview', // Using xtype as selector
}
var main = this.getMain() // Works fine
...
// Create the first instance
var list = this.getMyList().create(); // Undefined, but not sure why
...
// Get subsequent references?
var list = this.getMyList(); // Didn't get this far
...
Old approach:
Ext.define('MyApp.controller.MyController', {
extend: 'Ext.app.Controller',
views: [
'MyList' // May belong in the app definition
],
var list = this.getMyListView().create();
...
Please explain the proper way to create and reference views going forward. I tried the following approach and it did not work.
Ext.define('MyApp.controller.MyController', {
extend: 'Ext.app.Controller',
views: [
'MyList' // Does the views array belong in the app definition?
],
refs: {
// It made sense to me to autoCreate the main
main: {
selector: 'mainview',
xtype: 'mainview',
autoCreate: true
},
// Do I have to autoCreate all views?
myList: 'mylistview', // Using xtype as selector
}
var main = this.getMain() // Works fine
...
// Create the first instance
var list = this.getMyList().create(); // Undefined, but not sure why
...
// Get subsequent references?
var list = this.getMyList(); // Didn't get this far
...