Replies: 2 comments 5 replies
-
I think you've got the right idea in terms of how to build this and it sounds like you're almost there. This isn't a use-case I've personally tried building, so my best guess would be that you have to wait until after the draggable item is dropped before changing the id of the cloned item. Would be helpful if you could provide a CodeSandbox if you need further assitance. |
Beta Was this translation helpful? Give feedback.
-
I had exactly the same issue. I solved my problem by generating the ids for items beforehand, and replace the used items (that have been dragged) with object with new ids. Think of the draggable items area as a vending machine. So in your case, a possible solution: left: draggable items, they are deep clone data objects of the originals with a new generated ids After an item being dragged and added to the sortable list, simply replenish the left area — replace the dragged item with a new copy with new generated id, or simply replace the id. |
Beta Was this translation helpful? Give feedback.
-
i have 2 areas
left: draggable items (id's should not change)
right: sortable items
i want to copy dragable items (using cloneDeep, because it is a tree) into sortable items
if i do this, i need to generate new id's
i do this (on adding to right sortable):
but now, my sortable item do not respond to move
i think, i need to change somewhere else internally id of my active dragged item (because it is changed during dragging!)
But how and where?
Beta Was this translation helpful? Give feedback.
All reactions