在我的應用程序中,我在工具欄中有一個按鈕。如果我單擊此按鈕打開一個窗口下面的代碼被執行:無法添加偵聽器以存儲在ExtJS控制器中
[...]
onClick: function() {
this.windowControl = this.getController('attributesearch.Window');
this.windowControl.init();
this.windowControl.showWindow();
}
[...]
該窗口包含一些inputfields與商店的組合框:在我的窗口控制我的init方法
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
});
要添加一個的onLoad監聽
我嘗試這個監聽器添加到店:
init: function() {
this.getAttributeQueryStore().on('load', this.onStoreLoad, this);
this.control({
'attributeSearchWindow': {
afterrender: this.onWindowRendered
}
});
},
第一李ne在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
}
支票控制檯'store',大概'store'是無法訪問 – MMT
editet爲CONSOLE.LOG到我的問題的答覆。商店是東西,但似乎沒有像我期望的那樣被實例化(不管它可能是什麼)。我無法找到'on','addListener'或ExtJS文檔向我展示的任何其他方法。 – semTex
嘗試在呈現事件後在窗口上綁定'store load'事件 – MMT