Skip to Content

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

How to identify the current lead selection is child or parent in rec node


I am using a recursive node to populate a table with TreeByNestingTableColumn as master column. Now my problem is how do I identify if the current selected row in the table is a child or parent? When I get the lead selection value, I find that its the same for the parent and the child. I am setting the isLeaf and hasChildren boolean properties appropriately as false and true for parent and true and false for child. But since the lead selection is returning the same the below rsTableElement always gives me the parent, I always get those parameter values as that of parent. I am writing this inside the onleadSelect event of the table.

IRsTableElement rsTableElement = (IRsTableElement) wdContext.nodeRsTable().getElementAt(wdContext.nodeRsTable().getLeadSelection());

In this scenario how do I know if the current selection is made on a child?

Appreciate for all help and any code snippets.



Former Member

Hi KN,

I guess you want to check if the node that you selected is parent or child.. This can be achieved by using getTreeSelection() method of IWDNode.

If you write following code in your lead selection action, you can determine the if it is a parent or child node.

wdComponentAPI.getMessageManager().reportSuccess(wdContext.nodeRsTable().getTreeSelection() +"");

the output will be something like

<ViewName>.RsTable.0.ChildRsTable.1.ChildRsTable.0.. depending upon which node you have selected.

That way you can find out if it is a parent or child node.


0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question