这应该有效:
Ext.define('DigitalPaper.controller.Documents', {
extend: 'Ext.app.Controller',
views: ['Documents'],
stores: ['Documents'],
models: ['Documents'],
init: function() {
console.log('[OK] Init Controller: Documents');
// get references to view and model classes which can be used to create new instances
console.log('View', this.getDocumentsView());
console.log('Model', this.getDocumentsModel());
// reference the Documents store
console.log('Store', this.getDocumentsStore());
}
});
这些方法由 Ext 控制器中创建 getter 的方法创建。
http://docs.sencha.com/ext-js/4-0/source/Controller.html#Ext-app-Controller
该方法如下所示:
createGetters: function(type, refs) {
type = Ext.String.capitalize(type);
Ext.Array.each(refs, function(ref) {
var fn = 'get',
parts = ref.split('.');
// Handle namespaced class names. E.g. feed.Add becomes getFeedAddView etc.
Ext.Array.each(parts, function(part) {
fn += Ext.String.capitalize(part);
});
fn += type;
if (!this[fn]) {
this[fn] = Ext.Function.pass(this['get' + type], [ref], this);
}
// Execute it right away
this[fn](ref);
},
this);
},