यह काम करना चाहिए:
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 नियंत्रकों
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);
},
स्रोत
2012-06-07 01:11:50
मिलता है कोई भी ऐसा कहता है कि "this.getViewDocuments();" संदर्भ होना चाहिए - या संदर्भ में "यह" क्या है, लोग मुझे इसका उपयोग करने की उम्मीद कर रहे हैं :( –
@PaulHutchinson ExtJS नियंत्रक परिभाषा के 'refs' अनुभाग का उपयोग करके, आप सामान्य रूप से एक्सेस किए गए घटकों के त्वरित संदर्भ बना सकते हैं। संदर्भ स्वचालित रूप से 'रेफरी' के लिए प्रदत्त पाठ के आधार पर 'गेटटर' विधियां बनाएं। इस उदाहरण में, निर्मित गेटर 'getViewDocuments' है। इसे पूरे नियंत्रक के नाम से बुलाया जा सकता है, जहां 'यह' नियंत्रक के दायरे को संदर्भित करता है। 'चयनकर्ता' परिभाषा परिणामी Ext.ComponentQuery.query() कॉल में उपयोग किया जाता है। ComponentQuery.query() के लिए दस्तावेज़ देखें और देखें कि चयनकर्ता परिभाषा कितनी शक्तिशाली हो सकती है! –