Skip to Content

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

Have some problems by adding children to a tree

Hello everybody,

i am currently trying to build a tree only with to main branches and each branch has one child. Seems not very difficult, but I think I have a basic problem whose solution i cannot find on my own.

I created a value node "eintraege" awith 3 value attributes "spalte1","spalte2","spalte3". The Recursion node is called "Blubb".Now I am trying this:

  IPrivateTreeView.IEintraegeNode node = wdContext.nodeEintraege();
   IPrivateTreeView.IEintraegeElement newElement = node.createEintraegeElement();
   newElement.setMaster("a");
   newElement.setSpalte1("b");
   newElement.setSpalte2("c");
   newElement.setSpalte3("d");
   wdContext.nodeEintraege().addElement(newElement);
   
   IPrivateTreeView.IEintraegeNode nodeChild = node.nodeBlubb();
   IPrivateTreeView.IEintraegeElement newChildElement = nodeChild.createEintraegeElement();
		newChildElement.setMaster("a");
		newChildElement.setSpalte1("b");
		newChildElement.setSpalte2("c");
		newChildElement.setSpalte3("d");
		
		node.nodeBlubb().addElement(newChildElement);

//Now the second entry

	 newElement = node.createEintraegeElement();
	 newElement.setMaster("a2");
	 newElement.setSpalte1("b2");
	 newElement.setSpalte2("c2");
	 newElement.setSpalte3("d2");
	 wdContext.nodeEintraege().addElement(newElement);
   

		  newChildElement = nodeChild.createEintraegeElement();
		  newChildElement.setMaster("a2");
		  newChildElement.setSpalte1("b2");
		  newChildElement.setSpalte2("c2");
		  newChildElement.setSpalte3("d2");
		
		  node.nodeBlubb().addElement(newChildElement);

But i am just able to oben the frist branch and everythink is working fine, I can see the children as well, but when I am trying to open the second branch nothing happens. What I am doing wrong?

Best wishes

Joachim Meyer

Message was edited by:

Joachim Meyer

Former Member replied

Context:

Entries (node, singleton=false)
-- key (attribute, string)
-- Children (recursion node -> Entries)

IEntriesElement a = wdContext.nodeEntries().createAndAddEntriesElement();
a.setKey("a");
IEntriesElement b = wdContext.nodeEntries().createAndAddEntriesElement();
b.setKey("b");

IEntriesElement a1 = a.nodeChildren().createAndAddEntriesElement();
a1.setKey("a1");
IEntriesElement b1 = b.nodeChildren().createAndAddEntriesElement();
b1.setKey("b1");

Armin

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