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.51k stars 3.69k forks source link

[feature] Replace column instead of pushing a new column #2400

Open r000tmnt opened 3 weeks ago

r000tmnt commented 3 weeks ago

I'll try to explain the situation as clear as possible. I'm working on a inventory with drag and drop functionality. Thinking it like something we can see in games such as Diablo which the system is displaying columns with item and the columns with nothing in it. But in my use case, there's another set of columns at the left side of the screen. Item's at the left side can be drag to the right side. But the item can only drop to the left side if the type is matching with the targeted column.

So, I'm wondering if it is possible to change the default behavior when the user drags the item and hover it on the column. Instead of pushing a new column into the list, can we replace the content of the targeted column in the preview phase so the number of columns won't go beyond the limit?

r000tmnt commented 3 weeks ago

Upon search through the document, it seem the behavior I want can be achieved with the swap plugin. I'll try it later.