-
10 Mar 2010 4:19 AM #1
[CLOSED] Ext 3.1.2 (rev 6140) Error in AsyncTreeNode.reload
[CLOSED] Ext 3.1.2 (rev 6140) Error in AsyncTreeNode.reload
Hi,
Since the latest change in Ext.data.Node I get an error in Node.remove when calling AsyncTreeNode.reload()
The error is:
this.parentNode is null
[Break on this error] this.parentNode.removeChild(this, destroy);
Which is in data/Tree.js
When i revert data/Tree.js to rev 6056 the problem is resolved.
The stack is (sorry for the layout):
AsyncTreeNode:
From here in Tree.js:Code:/** 50443 * Trigger a reload for this node 50444 * @param {Function} callback 50445 * @param {Object} scope (optional) The scope (<code>this</code> reference) in which the callback is executed. Defaults to this Node. 50446 */ 50447 reload : function(callback, scope){ 50448 this.collapse(false, false); 50449 while(this.firstChild){ 50450 this.removeChild(this.firstChild).destroy(); 50451 } 50452 this.childrenRendered = false; 50453 this.loaded = false; 50454 if(this.isHiddenRoot()){ 50455 this.expanded = false; 50456 } 50457 this.expand(false, false, callback, scope); 50458 } 50459}); //inherit docs 50339 destroy : function(silent){ 50340 if(silent === true){ 50341 this.unselect(true); 50342 } 50343 Ext.tree.TreeNode.superclass.destroy.call(this, silent); 50344 Ext.destroy(this.ui, this.loader); 50345 this.ui = this.loader = null; 50346 },
Code:destroy : function(/* private */ silent){ 49443 /* 49444 * Silent is to be used in a number of cases 49445 * 1) When setRootNode is called. 49446 * 2) When destroy on the tree is called 49447 * 3) For destroying child nodes on a node 49448 */ 49449 if(silent === true){ 49450 this.purgeListeners(); 49451 this.clear(true); 49452 Ext.each(this.childNodes, function(n){ 49453 n.destroy(true); 49454 }); 49455 this.childNodes = null; 49456 }else{ 49457 this.remove(true); 49458 } 49459 }, /** 49518 * Removes this node from its parent 49519 * @param {Boolean} destroy <tt>true</tt> to destroy the node upon removal. Defaults to <tt>false</tt>. 49520 * @return {Node} this 49521 */ 49522 remove : function(destroy){ 49523 this.parentNode.removeChild(this, destroy); 49524 return this; 49525 },
-
10 Mar 2010 4:20 AM #2
Fairly sure this is already fixed. Can you grab the latest?
Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
10 Mar 2010 5:06 AM #3
I am using the latest (from branch 3.1.x).
I delved in a bit further and I think this is the problem:
in reload the removeChild function calls .clear() on the node is returns.
Then .destroy() is called on that node which calls remove where the error is thrown because parentNode is already set to null by the first call to .clear()
-
10 Mar 2010 5:25 AM #4
As I said, I think it's fixed in the 3.2.x branch.
Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
10 Mar 2010 5:30 AM #5
I just compared AsyncTreeNode.js and Tree.js and they are the same in both branches.
I am checking out 3.2.x now and will try again but, if it is fixed, will this this be backported to 3.1.x?
-
10 Mar 2010 5:35 AM #6Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
10 Mar 2010 5:47 AM #7
Sorry about that. Is is indeed fixed in 3.2.x. Will this also be applied to 3.1.3?
Thank you for reporting this bug. We will make it our priority to review this report.


Reply With Quote