Skip to content

Instantly share code, notes, and snippets.

@ledil
Created July 12, 2017 07:46
Show Gist options
  • Save ledil/05762cb72f7523990df4b21d62683461 to your computer and use it in GitHub Desktop.
Save ledil/05762cb72f7523990df4b21d62683461 to your computer and use it in GitHub Desktop.
extjs grid store abort
Ext.define('Ext.enhance.data.Store', {
override: 'Ext.data.Store',
constructor: function(config) {
var me = this;
me.callParent([config]);
me.on({
'beforeload': function(store, operation) {
// keep the operation which has request object
store.lastOperation = operation;
}
});
},
abort: function() {
var me = this;
if (me.loading && me.lastOperation) {
var requests = Ext.Ajax.requests;
for (id in requests) {
if (requests.hasOwnProperty(id) && requests[id].options == me.lastOperation.request) {
Ext.Ajax.abort(requests[id]);
delete requests[id];
break;
}
}
}
}
});
grid.store.abort();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment