If your dataProvider is XML, you can use parent() to recursively traverse
the ancestors.  If it is XMLListCollection, I am not sure, but would expect
there to be some kind of parent property.

 

Tracy Spratt,

Lariat Services, development services available

  _____  

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of Greg Lafrance
Sent: Saturday, January 09, 2010 8:58 PM
To: flexcoders@yahoogroups.com
Subject: [SPAM] [flexcoders] How to get all tree node parents upon select

 

  

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:

<products>
<item>
<sku>1001</sku>
<quantity value="100" />
</item>
<item>
<sku>2001</sku>
<quantity value="250" />
</item>
<item>
<sku>3001</sku>
<quantity value="300" />
</item>
</products> 

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

<products><item><sku>

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:

<products><item><sku><quantity>

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. 



Reply via email to