Question regarding tree to show recursive data structure

Hi there, I would like to use a tree like to display the different geographic divisions of a country. I have a table with a recursive organisation parent/child, but when I use it as the source for the tree it does not group together all the siblings, and shows a parent row for each of them.
I could handle this if the number of divisions is known before hand by creating tables for each level but I do not find that solution very elegant. Besides it would be a different on different scenarios

Thanks!

Are you using Tree or TreeGrid? Can you post a screenshot from your app now and how you want to look?

I am first trying yo use tree, it worked for a situation where I had only two levels and the keys for the first level were on a different table.
I am including a screenshot of the table and how the tree looks like. Tree is bounded to this table, level one and level two use it as schema, one displaying parent another displaying key,

And this is how it looks when I expand, "Provinces" is empty and one country shows its provinces grandchildren and the other shows its capital grandchildren
29 17

You want top -> down structure, right? Northwind Employees is a self-referencing table as well, here is how to display it:

  1. First get the employees not reporting to anyone and use it for first level:


  2. Then get the employees reporting to expanded employee:


Here is how it looks runtime:

Thanks a lot, I am still stuck not sure why. I can get the root node with no problem, then when I use this filter to expand the children

parent eq ${event.data.key}

I get the following (no children)
25
then I replaced the filter with this hardcoded condition, to test where my error is

parent eq 'Provinces'

Now it expands to the provinces, not the proper children but shows that the event is working and the children are being associated with the node..

50

Thanks a lot!

Try changing your filter to parent eq '${event.data.key}' (quotes are needed for literal string values such as 'Provinces')

1 Like

You were right! I missed the quotes. Now it is working as expected.
Thanks a lot