cancel
Showing results for 
Search instead for 
Did you mean: 

SAPUI5 - TreeTable

Former Member
0 Kudos

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

junwu
Active Contributor
0 Kudos

can you post your annotation regarding the hierarchy? it is in your metadata tile.

Former Member
0 Kudos

The problem is, I don't see any annotations there regarding a hierarchy. The hierarchy is build with CDS:

define hierarchy ZHI_EMPLOYEEHIER

as parent child hierarchy(

source ZHI_EMPLOYEERELATION

child to parent association _Manager

start where

Manager is initial

siblings order by

Employee

orphans root

)

{

@ObjectModel.foreignKey.association: '_Employee'

key Employee,

_Employee,

Manager,

_Manager,

$node.node_id as Child_ID,

$node.parent_id as Parent_IDs,

$node.hierarchy_is_orphan as HierarchyIsOrphan,

$node.hierarchy_level as HierarchyLevel,

$node.hierarchy_rank as HierarchyRank,

$node.hierarchy_parent_rank as HierarchyParentRank,

$node.hierarchy_tree_size as HierarchyTreeSize,

$node.hierarchy_is_cycle as HierarchyIsCycle

}

Former Member
0 Kudos

The oData is built with Service-Definition and Service-Bindings

junwu
Active Contributor
0 Kudos

I think you need to have hierarchy related annotation in your metadata, if not, how can the hierarchy to be rendered by frontend?

Former Member
0 Kudos

Really? 😉

View Entire Topic
alisonv
Explorer
0 Kudos

Did you have an answer ?