cancel
Showing results for 
Search instead for 
Did you mean: 

Help in getting current expanded node in Tree UI

Former Member
0 Kudos

HI,

I have a requirement to build a tree dynamically. On expanding each node I need to create sub nodes inside that. But it is always creating inside the node where the lead selection is and not inside the current expanded node. Even though I have used getTreeSelection () to get the current element.

<b>Detailed description about the application.,</b>

I have created a context with the following structure,

TreeNode (0..n)

|

|--> ChildNode (recursive SiteTree)

|--> Name (string)

I have created a Tree UI Element in the view and inserted a node type 'TreeNodeType'.

I have set the properties of the inserted node type as given bellow,

Value Attribute in TreeNode -> Name I have assigned to 'Text' property of 'TreeNodeType'.

Initially I have created four nodes in the init() method ., using the following code :

for(int i=0;i<3;i++)

{

IPrivateTestTreeView.ITreeNodeNode treenode=wdContext.nodeTreeNode();

IPrivateTestTreeView.ITreeNodeElement treeelement=wdContext.createTreeNodeElement();

treeelement.setName("Testroot:"+i);

treenode.addElement(treeelement);

}

Now I need to create sub-nodes for this dynamically.,

I have created an action and called it in 'onLoadChildren' event of 'TreeNodeType' with the following code:

public void OnCurrentSelection()

{

IPrivateTestTreeView.ITreeNodeElement el = wdContext.nodeTreeNode().getTreeSelection();

wdComponentAPI.getMessageManager().reportSuccess(el.getName());

}

<b>

Where this returns me only the name of LeadSelection node and not the node which i try to expand. </b>

Is there anyway I can get the currently expanded node., Kindly help me out in this.

  • Points will be rewarded for helpful answers. Thanks in advance.

Regards,

Nirmal

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Have you checked the action parameter, if that doesnt help

as a work around you can try creating a calculated attribute of type boolean and bind this to the expanded property of the Tree By Nesting Table Column.

When you expand and collapse the call will come to this get and setters.

their you can try to set the lead selection to the the element.

Regards

Ayyapparaj

Former Member
0 Kudos

HI Ayyapparaj ,

<b>First I would like to thank you for your reply.</b>

So it means that we cannot identify the currently expanded node in tree UI element and It will always be the lead selection node we will be able to get rite?

Can we make the current lead selection to currently expanded node 'By Default'?

Coming back to your solution.,

I created a context element 'isExpanded' of type boolean inside the TreeNode.

You said that there will be a call made to 'getter and setter' methods while we expand the node and we can set the lead selection to that element from there.

Could you please give me some more details of how to achieve it.

Thanks in advance.

Regards,

Nirmal G

Former Member
0 Kudos

<b>My requirement is very basic. I just need to create a sub-node when I expand a parent-node. Its really shocking to hear that Tree UI in webdynpro does not support even this basic functionality.</b>

Former Member
0 Kudos

Hi Nirmal,

You can get the thing you are looking for.

http://help.sap.com/saphelp_nw70/helpdata/en/ef/965640f5f60272e10000000a155106/frameset.htm

Go through this example. The parameter mapping needs to be done in WDDoModifyView for that.

Regards,

Murtuza

Former Member
0 Kudos

Hi Murtuza,

Thanks for the link. It really helped me in solving the issue.

Marks are awarded for valuable solutions.

regards,

Nirmal

Answers (0)