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

Multiple `useSortable` within an `DndContext`

Open jiwanovski87 opened this issue 1 year ago • 0 comments

Hi everyone, I am working on building a tree component. Therefore I already checked the tree example und multiple container example. I want to edit the tree and therefore I have made an edit view where you can see the tree on the left side and a table with entries on the right side.

I now want to drag&drop entries from the table into the tree. This is nearly working but now I face following issue:

  • Currently the ID of the left useSortable (tree compionent) is the same as of the right useSortable (table component). Due to the Docs the ID need to be unique.
  • Having the same IDis also trouble when I want to drag an element of the tree and the same ID is listed in the table on the right side.
  • I tried to just to create a new ID within the DragStartEvent. But doing this will cause different other issues.

I believe dnd-kit will need that the e.active.id (from any event) is the same ID as of the object that I create in the tree. Otherwise he will lose the information, that I am still dragging the object.

Is anyone able to confirm my assumption? Does anyone have an idea how to solve this?

jiwanovski87 avatar May 15 '24 14:05 jiwanovski87