I have a TreePanel with a loader. I also have a TextField tha开发者_如何学JAVAt, after every keystroke (with buffer) reloads the loader.
If this was the case while a previous reload was happening, I want to cancel the current one and reload a new one. I currently have the abort working, but it prevents any reloads from there on....
// abort the previous call. Works, but then cant reload
thisTree.loader.abort();
// This works without the abort
thisTree.loader.baseParams.quicksearch_string = val;
thisTree.root.reload();.
Hopefully I am missing something fundamental, but cant seem to figure it out...
abort : function(){
if(this.isLoading()){
Ext.Ajax.abort(this.transId);
}
},
It looks like it is calling abort with the specific transaction ID of the request, so in my opinion it doesn't seem like there are any asynchronous issues here. You can test this, however, by putting an alert between the abort and reload calls to make sure the abort fully finishes before the reload function creates a new transaction ID.
I am, however, sort of surprised that:
thisTree.root.reload();
is working without the abort. What type of node is your root node? Ext.tree.AsyncTreeNode? The more common method I see is:
tree.getLoader().load(tree.root);
As from what I can see nodes do not always have a reload method.
More information is needed though. What does happen when aborting and calling reload? Firebug doesn't show any ajax requests?
精彩评论