我有一個5000毫秒超時的ajax TreeStore,並且當查詢執行時間超過超時時,我想捕獲該事件。我該怎麼做?ExtJS當查詢執行時間超過超時時捕獲事件
我TreeStore:
Ext.define('Portal.store.ObjectsTreeStore', {
extend: 'Ext.data.TreeStore',
model: 'Portal.model.ObjectsTreeModel',
proxy: {
type: 'ajax',
url: 'my/url.json',
timeout: 5000, // 5 seconds
reader: {
type: 'json',
successProperty: 'success',
messageProperty: 'message'
}
},
listeners: {
beforeload: function() {
console.log('1');
},
load: function() {
console.log('2');
},
exception: function() {
console.log('3');
}
}
});
有了這個代碼超過了查詢執行時間,並要求取消的時候我只趕上beforeload
事件。當一切正常時,我抓到beforeload
和load
。
謝謝,在你的例子中所有的作品,因爲我的期望,但我不能讓它在我的代碼工作。我試圖更深入地檢查我的代碼。 –