So first you need to write code that finds the node.  This is just some sort of algorithm, whatever makes sense for you if the data is sorted in some way or just a straight search otherwise.  Once you’ve found the node you can consider that a leaf right?  OK, keep a reference to that node.  Now walk up the parents of that node and call setIsOpen(parent, true, false) on the tree till you reach the top.  That last false is to make it not animate which should mean things will take effect quickly.  Now call getDisplayIndex on the tree, passing in your selectedNode.  Set the Tree’s vPosition to that (or some value near it) and you should bring it into visibility.

 

It’s possible that you will need to throw in some doLaters to make sure that the Tree has drawn before you try to get the display index.

 

Hope this can get you started,

 

Matt

 


From: [email protected] [mailto:[email protected]] On Behalf Of Nikmd23
Sent: Tuesday, August 02, 2005 6:58 PM
To: [email protected]
Subject: [flexcoders] selectedNode

 

I am having a tough time doing something I'm sure is simple with
the Tree control.  I have a tree of users, each user has a name
(being shown as the label of the tree) and a userID (the data of the
tree). I want to have a function that I pass a userID to, which
selects the proper user in the tree, and opens up the branches that
that user is in.  (So you can see the selected node).  If the tree
was long enough to create scrollbars it would be nice for the tree to
scroll so you can see the selected node, but that isn't really a
necessity. Has anyone done this yet?  All help is appreciated.






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Computer software testing Macromedia flex Development
Software developer


YAHOO! GROUPS LINKS




Reply via email to