2 Replies Latest reply on Sep 15, 2008 12:51 PM by Newsgroup_User

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

    Thamizhannal
      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?

        • 1. Re: Tree control - How to get the full path of selected Item in tree control
          ntsiii Level 3
          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
          • 2. Re: Tree control - How to get the full path of selected Item in tree control
            Level 7

            "Thamizhannal" <webforumsuser@macromedia.com> wrote in message
            news:gam9q8$4es$1@forums.macromedia.com...
            >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?

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

            HTH;

            Amy