I have an ajax TreeStore with 5000 ms timeout and I want to catch the event when query execution time exceeds the timeout. How can I do it?
My 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');
}
}
});
With this code I only catch beforeload
event when query execution time is exceeded and request canceled. When everything is ok I catch beforeload
and load
.
Just attach your exception listener to the proxy instead of the store. See example: https://fiddle.sencha.com/#fiddle/psj