-
11 May 2007 2:16 PM #1
Ext.data.Node bug moving between children/no_children states
Ext.data.Node bug moving between children/no_children states
The problem is that Ext.data.Node's leaf attribute is never modified once it was initially set. Ideally if it has children, leaf should be false; if it doesn't, leaf should be true. The only exception I've found is brought on by AsyncTreeNode marking nodes with remote children but no local children as not being leaves.
This seems to be the best solution, in Ext.data.Node:
If node is null then there are no children, so leaf should be true; otherwise, it should be false. Both appendChild and removeChild call that method, so it's a clean solution. This does not cause any side effects with the above-mentioned exception, AFAIK.Code:setFirstChild : function(node){ this.firstChild = node; + this.leaf = node ? false : true; },
-
12 May 2007 4:53 AM #2
Please search before mkaing posts in the bugs forum.
Leaf is a property that defines a node as a leaf - meaning it has no children and will never have any children. It's a leaf - not a empty branch. Think about a real tree outside on your lawn. Can a leaf one day sprout child leaves or branches?
-
12 May 2007 6:03 AM #3
I was thinking in Computer Science terms, where "a leaf node is a node of a tree data structure that has zero child nodes" and the converse is also holds. In fact your TreePanel also makes that assumption, since nodes with leaf=false but no children (locally or remotely) are still shown as leaves. Inconsistent terminology is always confusing
.
Sorry about not searching very deeply; for others' benefit, this is a thread I just found which gives a cleaner alternative solution (solving the problem through TreePanel instead of Node): http://extjs.com/forum/showthread.php?t=4126



Reply With Quote