Skip to Content

TreeNode event LoadChildren not triggered

Hello,

I have a dynamic tree which is, naturally, supposed to be filled when user axpands a node and onLoadChildren is called, but... for some reason it's just not.

Just for experiment I also created onAction with the same code and it's working just fine when user selects a node.

What could be the problem?

Here's how I work with the tree:

The first level is filled after button is clicked. This part works fine:

IPrivateViewPlanView.IOrgStructureTreeNode rootNode = wdContext.nodeOrgStructureTree();
		  IPrivateViewPlanView.IOrgStructureTreeElement treeElement;
		  for (int i = 0; i < wdContext.nodeObj_List().size(); i++) {
			treeElement = wdContext.createOrgStructureTreeElement();
			treeElement.setObjectId(wdContext.nodeObj_List().getObj_ListElementAt(i).getObjid());
			treeElement.setOrgNodeName(wdContext.nodeObj_List().getObj_ListElementAt(i).getStext());
			treeElement.setHasChildren(true);
			rootNode.addElement(treeElement);

Mapping the event parameters like this:

public void wdDoModifyView(com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)
  {
    //@@begin wdDoModifyView
	  if (firstTime){
		  IWDTreeNodeType treeNode = (IWDTreeNodeType) view.getElement("TreeNodeType");
		  treeNode.mappingOfOnAction().addSourceMapping(IWDTreeNodeType.IWDOnAction.PATH, "selectedElement");
		  treeNode.mappingOfOnLoadChildren().addSourceMapping(IWDTreeNodeType.IWDOnLoadChildren.PATH, "element");
	  }
    //@@end
  }

And here are the events:

public void onActionSelectNode1(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, sng.ru.viewplan.wd.comp.viewplan.wdp.IPrivateViewPlanView.IOrgStructureTreeElement selectedElement )
  {
    //@@begin onActionSelectNode1(ServerEvent)
	  
	  addChildren(selectedElement);
    //@@end
  }
  public void onActionLoadChildren1(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, sng.ru.viewplan.wd.comp.viewplan.wdp.IPrivateViewPlanView.IOrgStructureTreeElement element )
  {
    //@@begin onActionLoadChildren1(ServerEvent)
	  addChildren(element);
    //@@end
  }

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Posted on Dec 15, 2010 at 06:07 AM

    One more thing: I also get these warnings for both events:

    TreeNodeType 'onAction.onAction': Parameters of action 'SelectNode1' and event 'onAction' are not compatible

    TreeNodeType 'onAction.selectedElement': Parameter 'selectedElement(sng.ru.viewplan.wd.comp.viewplan.wdp.IPrivateViewPlanView.IOrgStructureTreeElement)' cannot be supplied

    TreeNodeType 'onLoadChildren.element': Parameter 'element(sng.ru.viewplan.wd.comp.viewplan.wdp.IPrivateViewPlanView.IOrgStructureTreeElement)' cannot be supplied

    TreeNodeType 'onLoadChildren.onLoadChildren': Parameters of action 'LoadChildren1' and event 'onLoadChildren' are not compatible

    Add a comment
    10|10000 characters needed characters exceeded

    • It seems I've forgotten to close this thread as I already solved the problem yesterday...

      Yes, the action was assigned and everything was double and triple-checked 😊

      Except the context node's cardinality -_-' Which at some point accidentally shifted from 0..n to 1..n. So each node always had one child node and onLoadChildren didn't work.

  • Posted on Dec 15, 2010 at 10:43 AM
    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.