dnd-kit icon indicating copy to clipboard operation
dnd-kit copied to clipboard

Question: Does `useSortable` support nested tree structure, and how to do this?

Open pureliumy opened this issue 3 years ago • 7 comments

This official sortable tree example uses a flat list data structure, But our data is organized in a nested tree structure, the SortableContext seems not proper to use.

Any suggestion or good practice here are very appreciated.

pureliumy avatar Jan 21 '22 07:01 pureliumy

It should. At least I got it working with easy by using this extraction of it.

Although it does not seem to support dragging between two different tree sources but since it's a wrapper of sorts it should not be hard to do.

joonasstenvall avatar Jan 22 '22 13:01 joonasstenvall

@joonasstenvall The example you provide actually uses flat list internally, what I want is rendering the tree by recursion, and no need to flatten the tree data, compute the depth, etc. These computations may cause performance problems if there are a lot of items.

pureliumy avatar Feb 07 '22 08:02 pureliumy

@pureliumy did you find a way of using dnd-kit for your need? I'm currently trying to do the same thing. Thanks!

fedeciancaglini avatar Mar 21 '22 18:03 fedeciancaglini

@pureliumy did you find a way of using dnd-kit for your need? I'm currently trying to do the same thing. Thanks!

Sorry, not yet.

pureliumy avatar Apr 06 '22 07:04 pureliumy

@pureliumy now did you find any way to make it work?

max-programming avatar Jul 07 '23 00:07 max-programming

its really hard I am working on it over 2 weeks already, without any solution

0-don avatar Jan 06 '24 20:01 0-don