9

I'm trying to use the directus tree view however it keeps telling me "The tree view interface only works for recursive relationships."

Not sure what I'm doing wrong and if someone can help.

team_page (singleton, created tree view item and selected team_member as relation)

-team_member (has foreign key set as "team" and was generated through creating the tree view on the team_page collection and setting its related collection to "team_member")

Structure

Tree view relationship

edit: Directus 9.5.1

1 Answers1

4

There's no information in the Directus documentation so I checked if the relational field "Tree view" works for displaying multi-level children of that item. I created first table Test, added string field name to it and then created "Many to One" relationship to the same table and named the "key" as parent_id. Now, I created relational field "Tree view" again to the same Test collection and set the "Foreign key" as parent_id. Display template I picked for the both Name.

Then I created the following tree: https://i.stack.imgur.com/VgBRb.png Set the parent as "One" for the item "Two", set the parent "Two" for the item "Three", etc. And it looked as expected when I opened the item "One": https://i.stack.imgur.com/WOqXW.png

Kaspar L. Palgi
  • 1,332
  • 10
  • 22
  • Thanks @kaspar-l-palgi, it's really helped me. I handled data model with your solution. But have one misunderstanding - how to organize this tree view in "Content" section? As I understand it's possible with bookmarks, but how to order it? Or there is a simplest way to show tree view in Directus interface? https://monosnap.com/file/CBihSVRwsZOVvxgOKtIlM9nJhjsA9t – ndK Mar 16 '23 at 00:01
  • > how to organize this tree view in "Content" section? Sorry, I don't understand what do you mean by "organize" and what is "Content" section – Kaspar L. Palgi Apr 26 '23 at 19:27