cancel
Showing results for 
Search instead for 
Did you mean: 

dynamic tree

Former Member
0 Kudos

Hello,

Is it possible to create dynamic tree? I would like to add new data as children during I get this data from R3.

Best Regards,

Marita

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

hi Matthias,

If your query is solved kindly close the discussion.

Regards,

Rohit

Former Member
0 Kudos

Hey Santhosh, Bharathwaj and Rohit,

thank you for helping me.

Best Regards,

Marita

Former Member
0 Kudos

Hi Mattias,

include tree UI element

create a node -root node

rt click on properties and give the option repeated node as the parent node

create a recursion node under it

create all the attributes required

give the option datasource as parent node

right click on the treenodetype and select properties

link the action option to an action say onSelect

the node should have the following attributes

hasChildren

display text

nodeurl

parent node

For each link find out the no of children using a method

write a function create sublinks having parentlink and no of children and parentnode element

within it call the function recursively

loop upto that and call the function for creating sublinks

write this code in init

if(firstTime)

{

IWDTreeNodeType nodetype = (IWDTreeNodeType)view.getElement("TreeNodeType1");

nodetype.mappingOfOnAction().addSourceMapping("path","selected_element");

}

This selected_element we should pass as parameter to onSelect to get whichever element we selected

Hope this helps you

Regards

Rohit

Former Member
0 Kudos

Hi,

I think your requirement is just to load the children dynamically..

If its so.. then create an action for onLoadChildren and pass the selected element using source mapping..

Use the selected element value as input to the RFC .. call the relevant details from R/3 and then populate the node..

the code will be something like

elem = selectedelement.node<child>.create<child>element

So whenever u want the child to be loaded the data will be retrieved from RFC and populated...

Hope this solves the problem..

Regards

Bharathwaj

Former Member
0 Kudos

Hi,

Are you talking about dynamically creating the context attributes???

Refer the document "Dynamically Creating, Building and Mapping a Context in Web Dynpro"

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/webdynpro/dy... creating, building, and mapping a context in web dynpro.pdf

Use the following code

1. Get the node info (if the node name is vnParent)

IWDNodeInfo parent = wdContext.nodeVnParent().getNodeInfo();

2. Create the child node

IWDNodeInfo child1 = parent.addChild("Child1",null,true,true,true,false,false,true,null,null,null);

3. Create the attributes under this node

IWDAttributeInfo attr1 = child1.addAttribute("Attr1","com.sap.dictionary.string");

If you require any further information on this let me know.

Regards,

Santhosh.C