You do not want everything to be possible for sorting.
The top <li> list should have draggables with helper: 'clone' , this helper parameter allows you to drag and drop <li> copies outside the list without changing the list itself. So you start with this:
$('#list-A li').draggable({ helper: 'clone' });
Then you need to make the bottom list droppable and you want to clone the elements when they are deleted. You can clone using the drop event:
$('#list-B ul').droppable({ drop: function(event, ui) { $(this).append($(ui.draggable).clone()); } });
You want to be able to move things in the bottom list and what's sortable there. So the bottom list should be sortable as well as droppable. You should also keep droppable from cloning while you only sort them. You can use the sortable start and stop events to set the data flag, and then check this flag in the droppable drop event handler. Something like this for sortable:
$('#list-B ul').sortable({ start: function(event, ui) { ui.item.data('sorting', true); }, stop: function(event, ui) { ui.item.removeData('sorting'); } });
and then add validation to the drop event handler:
$('#list-B ul').droppable({ drop: function(event, ui) { if(ui.draggable.data('sorting')) return; $(this).append($(ui.draggable).clone()); } });
Demo: http://jsfiddle.net/ambiguous/PyWAM/
source share