bird
Junior Member
Posts: 7
Registered: 2/14/2006
Member Is Offline
|
| posted on 3/23/2006 at 09:55 AM |
|
|
numeber of subnudes-Urgent
hi all ,
i want to ask you a question: when i am selecting a node in
the tree i can get its number (javascript: trees[0].toggle(78) for node 78 ) i could get it from o_root.o_selected.n_id.
My question is how i can know the number of the last subnode of this node.
for example: node number 78 has 5 subnodes that could
mean that the last subnode is 78+5=83 . But its not the correct answer when a subnode has sones.
So i could know the number of subnodes of the node 75
that is 5 (...a_children.length), but its not what i am looking for i want to know
the number of all the subnodes(grandchild + son)
of node 75 (that equals to the last subnode number).
thanks you for your time please respond to me.
|
|
|
rock
Moderator
Posts: 687
Registered: 4/15/2003
Member Is Offline
|
| posted on 3/28/2006 at 08:56 AM |
|
|
I'm not sure I understand what you want, but maybe following code could help you out:
o_item = o_root.o_selected;
alert(o_item.n_id); //say 78
o_lastchild = o_item.a_children[o_item.a_children.length-1];
alert(o_lastchild.n_id)
|
|
|
bird
Junior Member
Posts: 7
Registered: 2/14/2006
Member Is Offline
|
| posted on 3/30/2006 at 07:50 AM |
|
|
hi rock,
thank you for replying to me, i was looking for a way to open the tree ,after adding a node to it, in the same way before.
so, i needed to know the place in tree where i put the node. ( every node has subnodes -childes and we add new one at the last place in the
node)....
In fact i found a way to know this place by loop throw the childs until i get different n_depth . thank you for your solution it seem more Suitable.
|
|
|