Tree control - How to get the full path of selected Item in tree control

Tree control - How to get the full path of selected Item in tree control

Post by Thamizhann » Wed, 17 Sep 2008 03:33:44


I am Flex newbie. When the user clicks the particular item in the tree control
I just wanted to get it name along with it's full parent.
Here is my XML
var dirXML:XML=<root basename="/home/tcegrid">
<Directories>
<Dir Name=".autosave" />
<Dir Name=".emacs.d" />
<Dir Name="AnsysDistributed">
<Dir Name="opt"/>
<Dir Name="root" />
</Dir>
<Dir Name="postgres"/>
<Dir Name="FineTurbo"/>
<Directories>
</root>

The above XML is data provider for Tree control. When the user clicks the Dir
Name called opt. I wanted it absolute path in XML. say
Directories.Dir.Dir.@Name is opt
Can any one tell me how to get this?
 
 
 

Tree control - How to get the full path of selected Item in tree control

Post by ntsii » Wed, 17 Sep 2008 03:45:55

There is no built-in ancestor functionality in e4x.

You will need to use the "parent()" method in a loop to move back up the
ancestor chain until you hit the root, at which point parent() will be null.

Tracy

 
 
 

Tree control - How to get the full path of selected Item in tree control

Post by Amy Blanke » Wed, 17 Sep 2008 04:51:53


loop until the parent() property of the XML node is empty.

HTH;

Amy