Skip to Content

How to pass start node of OData TreeTable to backend

I'm probably missing something but I just can't seem to pass the start node of an OData Tree table to the backend. All the examples I can find seem to assume that the entity set you are retrieving is the complete list of values you want in your tree. But how do I set the level 0 start node?

In my case I’m providing the users with a subsection of the Cost Centre Hierarchy. I need to start the tree from a particular CC node relevant to the form they are currently viewing.

I’ve tried binding the dialog and the table to a navigation from an entityset that has my starting node, but in the gateway error log I can see it keeps trying navigate from a completely different entityset. (When I test this through my SAP Web IDE Local it actually works fine – picks up the correct entity for the navigation and the hierarchy works correctly - only seems to error if I try the same application via the Gateway server).

I also tried setting the key, and passing in a filter. None of which would work for me.

We were on SAPUI5 1.38.1 but we have since patched to 1.38.13.

Does anyone have advice, or even better an example, of how to set the top node of a Tree table?

Thanks.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Mar 15, 2017 at 10:51 PM

    For anyone else that might be having the same issue - here is the response from SAP:

    "For improving the performace in TreeTable, from version 1.38, the TreeTable gets the binding context as soon as the table is added to the view.

    In your case, when the table is added to the dialog, the binding request is already set and hence it is necessary to set the binding context before the table is added on the dialog."

    My code was:

    this._oParentView.addDependent(this._HierarchyDialog); //add the dialog into the parent view
    this._HierarchyDialog.setBindingContext(this.oFormContext); //Bind Hierarchy Dialog to FORM entity

    but this will not update the binding context (doesn't return an error either). Apparently it needs to be the other way around:

    this._HierarchyDialog.setBindingContext(this.oFormContext); //Bind Hierarchy Dialog to FORM entity
    this._oParentView.addDependent(this._HierarchyDialog); //add the dialog into the parent view

    Add comment
    10|10000 characters needed characters exceeded