Do it the other way around.  Find the nodes you want displayed, then use
xml.parent() to climb up the ancestor chain, expanding nodes as you go.
I have a simple example on www.cflex.net <http://www.cflex.net/> .

 

Tracy

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of j_lentzz
Sent: Tuesday, February 12, 2008 4:28 PM
To: [email protected]
Subject: [flexcoders] How to expand nodes down in trees

 

Hi,

I have an app where I need open up the nodes of a tree to display a
node chosen through a search text. For example, if I type 'flex' in
the search box, I need to display all the nodes that have 'flex' in
their label. This means that I need to open all the parent nodes down
to that node. I'm using flex 2, so I can't use any new Flex 3
methods. I have a routine that will recursively open up the parent
nodes from a given node, but it needs to start at the top of the tree
to work, so if many items are found it gets very slow. I'd like to do
it in a single pass. I can identify the nodes I want to display by
searching through the XMLList from calling
XMLListCollection(this.dataProvider).descendants(); Is there a way to
use this structure to determine the trail of nodes to open without
having to start at the top of the tree and recurse for each item?

Thanks,

John

 

Reply via email to