PDA

View Full Version : Callback not called in Ext.tree.TreePanel.selectPath



schmidetzki
11 Jun 2007, 12:01 PM
In some cases the callback is not called.

I changed the code of TreePanel.selectPath() (line 328) to the following and now the callback is called:



Ext.tree.TreePanel.prototype.selectPath = function(path, attr, callback){
attr = attr || "id";
var keys = path.split(this.pathSeparator);
var v = keys.pop();
if(keys.length > 0){
var f = function(success, node){
if(success && node){
var n = node.findChild(attr, v);
if(n){
n.select();
if(callback){
callback(true, n);
}
}
else callback(false, n); // please add this line to Ext !!
}else{
if(callback){
callback(false, n);
}
}
};
this.expandPath(keys.join(this.pathSeparator), attr, f);
}else{
this.root.select();
if(callback){
callback(true, this.root);
}
}
}
This seem to be a bug for me :-)
(Took me one houre plus to find out, why my callback wasn't called)

I try to reload the tree if selectPath fails to get fresh nodes from the server (someone else could have changed the data).
I try:



this.tree.selectPath(path, undefined, function(success){
console.log("selectPath callback");
if(!success){
console.log("path " + path + " not found")
this.reload(function(){
this.tree.selectPath(path, null, function(success){
if(!success)
console.log("after reload: still not found")
});
}.createDelegate(this));
}
else console.log("selected: ", path)
}.createDelegate(this))
May be there is an easyier way to do this ?

schmidetzki
30 Jun 2007, 2:48 AM
I can't understand this.
I analysed and described this bug in detail in this post.
To add this line of code should take one minute.

The only reason I can think of why this bug has not been fixed ist that this post has never been read by the Ext developers.

So tell be why I should take me time to post a bug together with a correction surgestion when it will be completly ignored?

I event posted a reminder in this post
http://extjs.com/forum/showthread.php?t=7589

jack.slocum
30 Jun 2007, 12:33 PM
schmidetzki,

Calm down. We didn't ignore your post and we do appreciate the detailed report. This release had quite a few bug fixes in it and somehow this one slipped through. I have added the change now and it will be in the next release.