My fiddle: http://jsfiddle.net/Yc9WY/42/
Here you will see two groups, each of which contains 3 containers with the ability to delete. You can move events from group 1 to group 2 and to any slot. This works great.
When a group is full, I would like to give the user the ability to sort this group by moving events up and down. They should still move the event out of the group if they choose.
You will see my commented code where I started integrating the sortable library, but I get strange behavior.
Note. I cannot replace my draggable / dropable only with sorting. I need explicitly defined droppable areas (3 per group) so that the event can exist in slots 1 and 3 of group 1.
Here is my code
$(document).ready(function() {
$(".drag").draggable({
revert: true
});
$(".sort").droppable({
drop: function(event, ui) {
if (!($(this).children(".drag").size() == 1)) {
$(this).append(ui.draggable);
ui.draggable.css({
left: 0,
top: 0
});
}
}
});
});
<div>Group 1:
<ul class="parent">
<li class="sort"><a href="" class="drag">event 1</a></li>
<li class="sort"><a href="" class="drag">event 2</a></li>
<li class="sort"></li>
</ul>
</div>
<div>
Group 2
<ul class="parent">
<li class="sort"></li>
<li class="sort"><a href="" class="drag">event 3</a></li>
<li class="sort"><a href="" class="drag">event 4</a></li>
</ul>
</div>
, !