nativesortable
nativesortable copied to clipboard
added support for multiple sortable lists.
Nice plugin, thought it would make sense to allow dragging between multiple native sortables on the same page. Changed so it always save the current drag item to a variable that all sortables can check themselves against. Then if the draggable's parent is different the item is cloned into to the new list and sorted accordingly
Sweet! A couple things:
- I noticed that it doesn't remove the class="sortable-dragging sortable-child" on the new list (just running through the demo)
- Mind modifying the demo to show this in action? Maybe something like this: http://jqueryui.com/demos/sortable/#connect-lists.
I also wonder if we should make it an option, like the connectWith
option on jQuery UI Sortable. Thoughts?
I know that this is an old PR, but still idea is really cool, my comment below.
- Usage of this global variable is terrible - I think that by using something like
connectWith
we could avoid it. - Classes are not being removed only when moving items between lists - this is because the
element
inonDragEnd
event here. We are adding an item which was not there before and it is not being refreshed. Proper way to handle it would be to delegate events to a different container element or to refresh theelement
provided while initialisingnativesortable
.
I will maybe put some time to figure this out as I need this plugin for my project.