Skip to Content
0

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

Nov 08, 2017 at 11:01 PM

118

avatar image

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.

10 |10000 characters needed characters left 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
1
* Please Login or Register to Answer, Follow or Comment.

5 Answers

Jun Wu Nov 08, 2017 at 11:09 PM
0

no way

Share
10 |10000 characters needed characters left characters exceeded
SAP Seeker Nov 09, 2017 at 02:31 PM
0

Thanks for your inputs.

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Nov 09, 2017 at 11:18 AM
0

you can't do like this!!!

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Nov 17, 2017 at 05:33 PM
0

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.

Share
10 |10000 characters needed characters left characters exceeded
Nigel James Feb 28 at 02:03 AM
0

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

Share
10 |10000 characters needed characters left characters exceeded