Initially the tree always loads collapsed. So what u need to do is
select the first node (root node) & expand it

tree.selectedIndex = 0
tree.expandItem(tree.selectedItem,true);

Then u need to move to the child node that u need to expand

tree.selectedIndex = x ( where x is the child node that needs to be
expanded)

then repeat the above code
tree.expandItem(tree.selectedItem,true);

Now u can move to the leaf node that u want selected by

tree.selectedIndex = x + i ( where i is the relative position of the
leaf node from its parent x)

That should do it.

Also note that if multiple nodes are open and u wish to do to a
particular leaf node then u need to set the selected index value as
the number of open nodes in the tree considering all open nodes.

For eg: If in my tree my 2nd child node is open & it has 2 leaf nodes
then if i want to go to the 3rd child node then the selected index
value should be set to 5 (3 + 2) & not just 3. But dont ask me how ur
gonna dynamically count how many nodes are open bcoz i havent figured
that out up till now :(

Enjoy.


On Apr 1, 4:27 pm, "[email protected]"
<[email protected]> wrote:
> I have a requirement where I have to load a Tree Hierarchy with a
> particular node expanded and in the expanded node a particular leaf
> pre selected.
>
> Any idea/code regarding this would be helpful.

-- 
You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en.

Reply via email to