on 04-20-2023 8:36 AM
Hey,
I can't get a herarchy from my oData. What exactly did I do wrong?
<mvc:View
controllerName="TreeTable2.controller.View"
xmlns="sap.ui.table"
xmlns:m="sap.m"
xmlns:mvc="sap.ui.core.mvc">
<TreeTable
id="myTreeTable"
selectionMode="Single"
enableColumnReordering="false"
expandFirstLevel="false"
rows="{
parameters : {
countMode: 'Inline',
numberOfExpandedLevels: 1,
treeAnnotationProperties : {
hierarchyLevelFor : 'HierarchyLevel',
hierarchyNodeFor : 'NodeID',
hierarchyParentNodeFor : 'ParentNodeID',
hierarchyDrillStateFor : 'HierarchyDrillState'
}
}
}">
<columns>
<Column label="Description">
<template>
<m:Text text="{Description}" wrapping="false" />
</template>
</Column>
<Column label="HierarchyLevel">
<template>
<m:Text text="{HierarchyLevel}" wrapping="false" />
</template>
</Column>
<Column label="NodeID">
<template>
<m:Text text="{NodeID}" wrapping="false" />
</template>
</Column>
<Column label="ParentNodeID">
<template>
<m:Text text="{ParentNodeID}" wrapping="false" />
</template>
</Column>
<Column label="HierarchyDrillState">
<template>
<m:Text text="{HierarchyDrillState}" wrapping="false" />
</template>
</Column>
</columns>
</TreeTable>
</mvc:View>
onInit: function () {
var oTreeTable = this.getView().byId("myTreeTable");
oTreeTable.bindRows({
path: '/ZC_EMPLOYEE_TEST'
});
}<br>
regards
Tim
Hi Tim,
It seems to me like you are trying to bind your table to 2 different entity set, once onInit and once in the view itself? Make sure you are binding the correct entity set - you shouldn't need to do anything for this onInit at all.
Besides, I do see a hierarchy rendered in your screenshot, it just isn't expanded. If you want to show the nodes as initially expanded, you can pass below parameter to your row binding in the XML view.
numberOfExpandedLevels: 1
If there was no hierarchy, the framework would not even render the arrow to collapse.
Or are the fields inside empty? If that is the case, you might need to make some adjustments to your OData Service or alternatively bind the table to a JSON Model with deep structure instead.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Tim,
I think your view should still be rendering despite this error, is it not?
Please compare with this sample for Basic OData Tree Table binding, like you are attempting, and see if you can identify any differences. Or if you can try with oData Annotations like here.
Hey Leoni,
yes the view is still rendering. My app is already based on the example you mentioned. I have now gone through everything again step by step and with the mock data from the example it works, just not with the data from the oData. So I would actually say it is because of the oData or the CDS-Views...
The CDS views I built for this example are based on the example in the book "Core Data Services für ABAP". Now the basic question is how must the CDS view be structured? I have built the example according to the method of CDS hierarchies. However, there is a basic distinction between "annotation-based hierarchies" and "CDS hierarchies". Is it at all possible to build a SAPUI5 or Fiori Elements app on the basis of CDS hierarchies or must annotation-based hierarchies be used in principle?
regards Tim
User | Count |
---|---|
83 | |
9 | |
9 | |
7 | |
7 | |
7 | |
7 | |
6 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.