Skip to Content

sap.ui.table.TreeTable - Not displaying hierarchy when loaded from flat json structure

Hello,

I am trying to implement a tree structure with the help of sap.ui.table.TreeTable as shown in Sample. But instead of displaying hierarchy as parent/child nodes, the tree table is displaying every row as parent entry.

We have a flat structure data from a table in json format and without converting them to hierarchical format json, is it possible to display them as parent/child nodes ? Have anybody implemented it ? If yes, can you please share the logic/code information ?

Thanks.

Add comment
10|10000 characters needed characters exceeded

  • like Jun Wu and Chandeep said - this is not possible with a flat structure, instead, you need to format your json structure as a hierarchy.

    every level (parent) needs to contain a child in order to reflect the levels in the tree, for example:

    aTree = [ { propA: 'parent1', children: [ { propA: 'child of parent 1', children:[] } ] }, 
    { propA: 'parent2 no children', children: [] } ] then you can assign this to the model and bind it to the tree table
  • Get RSS Feed

5 Answers

  • Nov 08, 2017 at 11:09 PM

    no way

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 09, 2017 at 02:31 PM

    Thanks for your inputs.

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 09, 2017 at 11:18 AM

    you can't do like this!!!

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 17, 2017 at 05:33 PM

    Hi,

    If you want to display the data in tree format then the you are fetching alsoshould be in the same way.

    Please find the example in the below link

    https://embed.plnkr.co/pn3BRS4EvjWTMtBfDJia/

    Let me know if you have any doubt on this.

    Thanks,

    Deepak Raj.

    Add comment
    10|10000 characters needed characters exceeded

  • Feb 28 at 02:03 AM

    It is the

    "HierarchyLevel": 1,
    and the
    "ParentNodeID": 2,

    fields that you need to take care of to ensure that they are set correctly.

    HTH,

    Nigel

    Add comment
    10|10000 characters needed characters exceeded