I have two connected sortable lists. I don’t want the user to be able to leave a list empty. They must have at least one item in the list at all times.
I was trying to do something a long the lines of:
$( "#unused, #used" ).sortable( {
connectWith: ".connectedSortable",
placeholder: "placeholder",
items: "li:not(:only-child)"
}).disableSelection();
Anyone know how to do this?
Use the cancel option instead of items:
This option will prevent sorting when only one item left in the sortable list.
See a working example here.