cancel
Showing results for 
Search instead for 
Did you mean: 

Accessing the parent element of a tree node !

Former Member
0 Kudos

Hi All,

I’m building a tree application, in which the user has the option for creating a new node at any level he wants. But my problem is, If the user wants to create a node at the same level of the selected node, how do I retrieve the parent element? Can someone help me in this regard? I’ve done the following

1) Created a node “TreeNode” with the required attributes & the recursive node.

2) When the user clicks on any node, I am able to retrieve the selected element through recursive traversal (i.e. the instance of TreeNodeElement, say elmt)

3) I was able to retrieve the parent element through the function elmt.node().getParentElement(). But it returns an instance of IWDNodeElement, which does not have the recursive node. Ofcourse, I cannot typecast IWDNodeElement to “TreeNodeElement”.

Then How do I retrieve the “TreeNodeElement” instance of the parent element? Someone please help…..!

Thanks in Advance,

Best Regards,

Nibu.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Nibu,

you should type as follows

IPrivateRecursiveTree.ITreeNodeElement ele=(IPrivateRecursiveTree.ITreeNodeElement)selectedElement.node().getParentElement();

this way you will get the Parent element of the current node.

Rgds,

Vilish

P.S. If prob solved, consider reward points

Answers (1)

Answers (1)

Former Member
0 Kudos

hello Nibu,

try this code:

elmt.node<recursiveNode>().getParentElement();

regards,

Piyush.

Former Member
0 Kudos

hello Nibu,

sorry dont use node<recursiveNode>

parent = (IprivateView.ITestNode) elmt.node().getParentElement();

regards,

Piyush.