SortableJS / Sortable

Reorderable drag-and-drop lists for modern browsers and touch devices. No jQuery or framework required.
https://sortablejs.github.io/Sortable/
MIT License
29.78k stars 3.7k forks source link

[QUESTION] Use with tree structure table. #2344

Closed AFrantsevich closed 9 months ago

AFrantsevich commented 10 months ago

Custom

Hi there! I have tree structure like table. Is there any way how to use nested sortable in this case? The group attribute can help me?) Or in this structure it's impossible?

Thanks a lot!

Reproduction codesandbox: https://jsbin.com/geqonosaqa/edit?js,output

owen-m1 commented 9 months ago

Yes you can, you need to add a sortable container to each item and nest the child elements in there. The group can be the same for all sortable instances.

AFrantsevich commented 9 months ago

Yes you can, you need to add a sortable container to each item and nest the child elements in there. The group can be the same for all sortable instances.

Hi Owen! Thanks a lot for the answer! But, could you give a little more information? Do you mean that each node with children should be wrapped in div tag? Maybe there are some examples?