4

I am trying to create a tree table from an EntitySet (say E1), in my FIORI App.

I have my controller and extended View and the data is properly bound between the two.

I am referring to the Official SAP Demo Explored Kit for the tree table code.

  1. There, they are taking 5 parameters as input, as JSON. Sample data for the root node:

    {
    "NodeID": 1,
    "HierarchyLevel": 0,
    "Description": "1",
    "ParentNodeID": null,
    "DrillState": "expanded"
    },
    

    Now, I don't have the "DrillState" field in my OData EntitySet. What is the purpose of this field and will my tree appear properly without it? I can hardcode the logic if required.

  2. Currently I am not passing the "DrillState". And my Output looks weird. It's just a normal table without the tree structure and all are at the same level (But the first column does have the "expand or collapse" button attached to it, but it serves no purpose).

Following is my XML Code:

    <table:TreeTable
        id="treeTable"
        selectionMode="Single"
        enableColumnReordering="false"
        expandFirstLevel="false"
        rootLevel="01"
        useGroupMode="false"

    rows="{
        path: '/ZSC',
        parameters : {
            countMode: 'Inline',
            treeAnnotationProperties : {
                hierarchyLevelFor : 'tree_level',
                hierarchyNodeFor : 'Node',
                hierarchyParentNodeFor : 'parent'
            }
        }
    }">

<!-- add drill state in property and path also-->


    <table:columns>

         <table:Column label="Hier_ID">
            <table:template>
                <Text text="{Hier_ID}"/>
            </table:template>
        </table:Column>

        <table:Column label="tree_level">
            <table:template>
                <Text text="{tree_level}"/>
            </table:template>
        </table:Column>

        <table:Column label="Node">
            <table:template>
                <Text text="{Node}"/>
            </table:template>
        </table:Column>

        <table:Column label="parent">
            <table:template>
                <Text text="{parent}"/>
            </table:template>
        </table:Column>

    </table:columns>

</table:TreeTable>

Where am I going wrong? Or do I have to do map it in a different way since I am taking data from an entity set and in tutorial they are directly passing as JSON object

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
guitar_geek
  • 498
  • 2
  • 9
  • 19
  • What happens if you include “DrillState”? Please see also [SAP Annotations for OData Version 2.0](https://wiki.scn.sap.com/wiki/display/EmTech/SAP+Annotations+for+OData+Version+2.0) and look for hierarchy-drill-state-for. Maybe the following links might also be helpful: [TreeTable Odata binding](https://blogs.sap.com/2015/10/23/treetable-odata-binding/) [ODataTreeBinding](https://sapui5.hana.ondemand.com/#docs/api/symbols/sap.ui.model.odata.v2.ODataTreeBinding.html) –  Feb 20 '17 at 13:49

1 Answers1

0

Although SAP Annotations for OData Version 2.0 - Entity Set with Hierarchy mentions hierarchy-drill-state-for under (good-to-have)

In addition, further useful hierarchy information can be added via properties annotated with...

The below is logged from ODataTreeBinding.js. So hierarchy-drill-state-for is more like a must-have in addition to hierarchy-level-for, hierarchy-parent-node-for, hierarchy-node-for, hierarchy-drill-state-for

"Incomplete hierarchy tree annotations. Please check your service metadata definition!"

You need specify them as below.

<TreeTable
selectionMode="Single"
rows="{
  path: '<your path>',
  parameters : {
  treeAnnotationProperties : {
                hierarchyLevelFor : '<your property>',
                hierarchyNodeFor : '<your property>',
                hierarchyParentNodeFor : '<your property>',
                hierarchyDrillStateFor : '<your property>'
            }
  }
}">
nitmoi
  • 1