Skip to Content

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

How do you get the child node of a selected node in TreeByNestingTablColum?


I have a call to getTreeSelection() to get the current selected node in a TreeByNestingTableColumn table.

I now want to check if the current IWDNodeElement I just retrieved has another node as its child or is it a leaf?

For retrieving the current selected element in the tree I can do this:

IPrivate(n).I(n)Element selectedElem = wdContext.node(n).getTreeSelection();

Now this only retireves one element into selectedElem.

I cannot use currentChild(n)Element because that returns the lead select element, and in a TreeByNestingTableColumn this is not a unique value depending on where you are in the tree structure.

So my question is, how can I retrieve the current selected element in the tree and its child? I dont need all its children, just the first child is enough to get the info I need.

Please help.



Former Member
Former Member replied


This code will retain the lead selection as expected.

IPrivateSecondView.ICatalogEntriesElement ele;
try {
ele = (IPrivateSecondView.ICatalogEntriesElement)wdContext
//load the children if they are not loaded
if(!ele.getChildrenLoaded()) {
   addCatalogEntries(ele.nodeChildCatalogEntries(), ele.getID());
   //set the tree selection back to the original element
   //check if the first child of this node has a child of its own
//if the children have been loaded simply check if the first child is a leaf
else if(ele.getChildrenLoaded()) {
} catch (WDContextException e) {logException(e);}

Do you want all the nodes to be expanded when the application loads? I did not understand the last part of your reply.



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