Thank you for reporting this bug. We will make it our priority to review this report.
-
Sencha User
bug in AsyncTreeNode : expand
when expanding a node and it has not been expanded yet - it does
Code:
this.ui.beforeLoad(this);
but it doesnt do a
Code:
this.ui.afterLoad(this);
which replaces all the node icons with the spinning wheel.
-
Sencha User
This will fix the problem:
Code:
Ext.override('Ext.tree.AsyncTreeNode', { expand : function(deep, anim, callback, scope){
if(this.loading){ // if an async load is already running, waiting til it's done
var timer;
var f = function(){
if(!this.loading){ // done loading
clearInterval(timer);
this.expand(deep, anim, callback, scope);
}
}.createDelegate(this);
timer = setInterval(f, 200);
return;
}
if(!this.loaded){
if(this.fireEvent("beforeload", this) === false){
return;
}
this.loading = true;
this.ui.beforeLoad(this);
var loader = this.loader || this.attributes.loader || this.getOwnerTree().getLoader();
if(loader){
loader.load(this, this.loadComplete.createDelegate(this, [deep, anim, callback, scope]), this);
this.ui.afterLoad(this);
return;
}
this.ui.afterLoad(this);
}
Ext.tree.AsyncTreeNode.superclass.expand.call(this, deep, anim, callback, scope);
}
});
-
I don't believe that the AsyncTreeNode has an afterload event. Thanks for sharing your solution with the community.
-
Sencha User
AsyncTreeNode has no beforeload() either. But AsyncTreeNode extends TreeNode which has a ui member variable which is of instance TreeNodeUI, and it has both beforeload() and afterload():
Code:
Ext.tree.TreeNodeUI = Ext.extend(Object, {
...
// private
beforeLoad : function(){
this.addClass("x-tree-node-loading");
},
// private
afterLoad : function(){
this.removeClass("x-tree-node-loading");
},
...