-
-
Save ledil/05762cb72f7523990df4b21d62683461 to your computer and use it in GitHub Desktop.
extjs grid store abort
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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