私のアプリケーションでは、ツールバーにボタンがあります。このボタンをクリックしてウィンドウを開くと、次のコードが実行されます。
[...]
onClick: function() {
this.windowControl = this.getController('attributesearch.Window');
this.windowControl.init();
this.windowControl.showWindow();
}
[...]
このウィンドウには、いくつかの入力フィールドとストアのあるコンボボックスが含まれています。
Ext.define('EM.store.AttributeQuery', {
requires: ['EM.model.AttributeQuery'],
model: 'EM.model.AttributeQuery',
proxy: {
type: 'ajax',
url: './app/configuration/AttributeQueries.json',
reader: {
type: 'json',
root: 'queries'
}
},
autoLoad: true
});
ウィンドウ コントローラーの init メソッド内で、1 つのonLoad-listenerを追加したいので
、このリスナーをストアに追加しようとします。
init: function() {
this.getAttributeQueryStore().on('load', this.onStoreLoad, this);
this.control({
'attributeSearchWindow': {
afterrender: this.onWindowRendered
}
});
},
init メソッドの最初の行でthis.getAttributeQueryStore().on('load', this.onStoreLoad, this);
、次のエラーが発生します。
Uncaught TypeError: Object [object Object] has no method 'on' app/controller/attributesearch/Window.js:9
.
ストアが完全に (または正しく) インスタンス化されていないようです。私は何が欠けていますか?
編集:
のコンソール出力this.getAttributeQueryStore()
は次のとおりです。
constructor {self: function, superclass: Object, config: emptyFn, initConfigList: Array[0], initConfigMap: Object…}
__proto__: TemplateClass
$className: "EM.store.AttributeQuery"
autoLoad: true
config: emptyFn
configMap: TemplateClass
initConfigList: Array[0]
initConfigMap: Object
model: "EM.model.AttributeQuery"
proxy: Object
requires: Array[1]
self: function constructor() {
superclass: Object
__proto__: Object
}