cancel
Showing results for 
Search instead for 
Did you mean: 

Reading a webdynpro tree

Former Member
0 Kudos

Hi,

I am working on webdynpro tree, it has 4 levels using recursive node .I am able to successfully create the tree.

But I am unable to find the value that the user is selecting .

Please let me know the way to read a webdynpro tree.

Regards

Tiny

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

I hope you are using Tree UI to build the tree. If so the TreeNodeType added to the Tree UI has "onAction" event defined.

You can access the currently selected value, in this method. Follow the below steps

1. Create an onAction event handler for the TreeNodeType

2. While creating this event handler add an input parameter called "selectedElement" of type IWDNodeElement

3. Add the below mentioned code in the wdDoModify() method


if(firstTime){
              IWDTreeNodeType treeNode = (IWDTreeNodeType) view.getElement("TreeNodeType");
              treeNode.mappingOfOnAction().addSourceMapping("path", "selectedElement");
}

4.In the event handler created add the below code


IPrivate<VeiwName>.I<RootNodeElement> element = (IPrivate<VeiwName>.I<RootNodeElement>) selectedElement;
String selectedValue = element.getVa_Value();

Assuming Va_Value is the attribute under the RootNode.

Also access this link for more info

[http://help.sap.com/saphelp_nw70/helpdata/en/c0/088b41b4b3b25fe10000000a1550b0/frameset.htm]

Regards,

Vishweshwara P.K.M

Edited by: Vishweshwara P.K.M on Dec 14, 2010 4:36 PM

Edited by: Vishweshwara P.K.M on Dec 14, 2010 4:38 PM

Former Member
0 Kudos

Hi Vishmeswara,

Thanks a lot !!! that helped..

Can u also let me know if there is a way to get the the parent node and root node from the child node?

Thanks a lot

Tiny

Former Member
0 Kudos

Hi,

Its very much possible to track down the child nodes, but getting the parent node is not possible. You can get the name(or value) of the parent element by maintaining an attribute called ParentName under the Rootnode and populating it with the parent name every time you create an element.

To get the Child nodes use the below code in the "onAction" event handler created (as explained in the above thread),


IPrivate<ViewName>.I<RootElement> childElement = null;
int noOfchild = element.nodeVn_ChildStructure().size();
for (int i = 0; i < noOfchild; i++) {		
         childElement = element.getVn_ChildStructureElementAt(i);
         String childName = childElement.getVa_Value();
         wdComponentAPI.getMessageManager().reportSuccess("Child Name is: "+childName);
}

assuming "Vn_ChildStructure" is the name of the recursion node placed under the root node.

Regards,

Vishweshwara P.K.M

Answers (1)

Answers (1)

Former Member
0 Kudos