I would advise using the dataProvider API rather than the tree.  You can
use the parent() method on any XML node.

Tracy

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of gaurav1146
Sent: Friday, August 01, 2008 2:58 AM
To: [email protected]
Subject: [flexcoders] Re: tree.getParentItem (node) when the node is
closed

 

Never mind, I just had to keep the index of top level node in my leaf
node. Then when the user clicked on the leaf node in other list I had
to call
tree.expandItem(tree.dataProvider.getItemAt([EMAIL PROTECTED]),
true);

This ensured that the node's parent was expanded and I could get the
parent by calling tree.getParentItem(node).

Regards,
Gaurav

--- In [email protected] <mailto:flexcoders%40yahoogroups.com>
, "gaurav1146" <[EMAIL PROTECTED]> wrote:
>
> Hi,
> Is there any way to get the parent item of a node in a tree when the
> node is closed. The method tree.getParentItem (node) returns the
> parent based on the current state of the tree (open/close). If the
> node is not visible in the current state of tree this method returns
null.
> 
> The thing is that I am displaying the leaf level nodes of the tree in
> another list where a user can select/ deselect them. In the other list
> I only have reference to the leaf level nodes of my tree and based on
> user's changes to the leaf level nodes I want to modify the original
> tree ( / parent of the nodes he changed).
> 
> I tried using the expandItem method so that once the tree is expanded
> I could get the parent. But looks like expandItem only works for non
> leaf nodes. Please let me know on how to go about it.
> 
> Regards,
> Gaurav
>

 

Reply via email to