cancel
Showing results for 
Search instead for 
Did you mean: 

Adding a node to a tree

Former Member
0 Kudos

How could we add a leaf node to a recursive tree under the selected node, if selected node is a leaf element then I need to make it as a node and under that the new element should be added.

thanks in advance

Dhanu.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Say you have the following context structure:


Things (node, 0:n)
-- Children (recursive node -> Things)

Then you can do something like


IThingsElement selectedThing = (IThingsElement) wdContext.nodeThings().getTreeSelection();
if (selectedThing != null && selectedThing.nodeChildren().size() == 0) 
{
  IThingsElement newThing = selectedThing.nodeChildren().createAndAddThingsElement();
}

Armin

former_member192434
Active Contributor
0 Kudos
Former Member
0 Kudos

Hi,

Please go through the pdf

Creating a Web Dynpro Tree

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f0ec6622-8da5-2a10-349b-868b6a55...

Regards,

ramesh