SimpleTree with Reordering list view

Hi All,

I have a Team model with SimpleTree trait because each team can have a parent team and many childrens.
I would like to make the users life easier to manage parent-child relations between the records so I am trying to use the Sorting Records feature of backend list.

I have added these lines to list config file:

structure:
    showTree: true
    showReorder: true

In the backend list view a drag and drop button appeared in every rows so I can drag them and sort them but every time I drag a a list item under an other one (so make it its child) the item disappears from the list. I realized that the list shows only the top level parent items.
There is no dropdown button next to the drag and drop button at all.

In the backend (if I change URL manually to open child item form) I can see that parent_id record properly set on the item so drag and drop works but child item does not appear in backend list.

I tried to convert the SimpleTree trait to NestedTree and when I tried then in the list the dropdown button appeared (so I see that an item has children) but when I open it down it does not show the children.

What am I doing wrong? :slight_smile:
How can I make it to look like a structure in Tailor?

Thanks in advance for your help!

Ok, I think I found the source of the strange behaviour of the structure tree view and managed to solve the problem.

Solution:

I have used/showed parent_id column in the list. As soon as I removed this field from the list view, all of my problem solved - structure feature (reordering) immediately started to work.

Maybe it is a known limitation of the feature but I did not find this info in the documentation, maybe it is a bug(?)… I do not know.

Oh, and one more tiny remark: I had to remove the id column as well because the tree view was a little messy when I had id column in the list because even sub-items had the same left-margin than its parent (so visually it was not easy to see the depths). When I removed id column as well from the list then tree view became prettier.

1 Like