3 Replies Latest reply on Jan 10, 2010 7:23 AM by iamfuric

    How to get all tree node parents upon select

    Gregory Lafrance Level 6

      I have a tree, and when user clicks an item in the tree, I want to get all the parents of the selectedItem node.


      So if I have this XML:


              <quantity value="100" />
              <quantity value="250" />
              <quantity value="300" />


      If user clicks on the 1001 sku, I want to get something like this:




      Also if I have a custom component, perhaps based on tree or but maybe not, and if this custom component shows the actual XML and used can click on XML elements or XML attributes, how can I use the selected item to get the parent nodes, so if they click on the value="100", I want to get this:




      I need this because I have a set of fields, and users will drag their XML node elements or attributes to my fields, to define a mapping between their XML and my fields.


      The selectedItem is just a snippet of XML cut off from its source XMLListCollection, and I might be able to search the XMLListCollection, but what if there were say <sku> elements at more than one level in the XML? I'm guessing a search might return multiple hits for a selected element, when I want the actual parent nodes for the actual selected node.


      Thanks very much!