Skip to Content

Hierarchy Structure not shown in SmartTreeTable generated via Metadata-Annotations

I've written a XML-Fragment to display a tree in a SmartTable.

<core:FragmentDefinition xmlns="sap.m" xmlns:t="sap.ui.table" xmlns:l="sap.ui.layout" xmlns:f="sap.ui.layout.form" xmlns:core="sap.ui.core" xmlns:smartTable="sap.ui.comp.smarttable" xmlns:smartFilterBar="sap.ui.comp.smartfilterbar" xmlns:customData="http://schemas.sap.com/sapui5/extension/sap.ui.core.CustomData/1">

<smartTable:SmartTable id="smartTreeTable" entitySet="GetDynStrucSet" tableType="TreeTable" useExportToExcel="false" useVariantManagement="false" useTablePersonalisation="true" header="Hierarchy" showRowCount="false" enableAutoBinding="true" beforeRebindTable="onBeforeRebindTable" initiallyVisibleFields="UiRowId,UiHierLevel,UiParentRowId">
</smartTable:SmartTable>

</core:FragmentDefinition>

In the Controller I pass Filters for the Service-Execution.

onBeforeRebindTable: function (oEvent) {
//pass selection filters before execute call
var oBindingParams = oEvent.getParameter("bindingParams");
oBindingParams.filters = this.getOwnerComponent().getModel("parameterModel").getData();
oBindingParams.parameters.numberOfExpandedLevels = 2;
}

The Service returns 30 records in this format:

But the SmartTable displays the Data like this:

The Tree-Structure and the Row-Values are wrong.

In my Service I used some help from this blog: https://blogs.sap.com/2015/10/23/treetable-odata-binding/

I set the following attributes for the marked properties:

> UIRowId => sap:hierarchy-node-for

> UiParentRowId => sap:hierarchy-parent-node-for

> UiHierLevel => sap:hierarchy-level-for

Why does my Tree look like these and how to fix this problem? Any ideas?

9hxdk.png (18.7 kB)
fitqm.png (109.2 kB)
2oq9g.png (36.3 kB)
Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

0 Answers