Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Help in getting current expanded node in Tree UI

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

Former Member

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question