Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple useSortable within an DndContext #1405

Closed
jiwanovski87 opened this issue May 15, 2024 · 1 comment
Closed

Multiple useSortable within an DndContext #1405

jiwanovski87 opened this issue May 15, 2024 · 1 comment

Comments

@jiwanovski87
Copy link

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
Copy link
Author

I was able to solve it...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant