Question

I have a Flex tree with an ArrayCollection as data provider. The collection holds an array of CategoryVO objects. Each object can have another array of CategoryVO objects inside it's "child" attribute. This way the tree displays the data correctly.

Now I want to get the parent of a specific item, e.g. tree.selectedItem. Using XML as data provider the item parent is available through the parent() method. But I can't convert my data to XML. How can I get an item's parent? Perhaps using the tree's dataDescriptor?

Was it helpful?

Solution

I just found out how to solve my problem :) The tree offers a getParentItem(item:Object) method that returns the parent item of the item. Notice that this function returns null for top level items.

OTHER TIPS

The DataDescriptor does not contain parent information.

The easiest solution I believe would be simply adding a reference to the parent in each CategoryVO object.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top