I have two list with 6 items, connectedWith a class of .connectedSortable
When I move an item between the two lists, it gets appended to the target list, and removed from the source list. So now we have a list with 5 items, and a list with 7 items. How can the items remain 6 items per list, and we just move the top most in the target list to the first list (automatically rearranges itself in the same order as if it were one list)?
<ul class="connectedSortable">
<li class="ui-state-default">Item 1</li>
<li class="ui-state-default">Item 2</li>
<li class="ui-state-default">Item 3</li>
<li class="ui-state-default">Item 4</li>
<li class="ui-state-default">Item 5</li>
<li class="ui-state-default">Item 6</li>
</ul>
<ul class="connectedSortable">
<li class="ui-state-highlight">Item 1</li>
<li class="ui-state-highlight">Item 2</li>
<li class="ui-state-highlight">Item 3</li>
<li class="ui-state-highlight">Item 4</li>
<li class="ui-state-highlight">Item 5</li>
<li class="ui-state-default">Item 6</li>
</ul>
$( ".connectedSortable" ).sortable({
connectWith: ".connectedSortable"
}).disableSelection();
To clarify: The number of lists may be 2 or more. But what I am after is the fixed number of 6 items per list and correct automatic rearrangement as sortable does if it were single list. An example is if you move item 3 from list1 to list2 after item 4, then the outcome should be this:
<ul class="connectedSortable">
<li class="ui-state-default">Item 1</li>
<li class="ui-state-default">Item 2</li>
<li class="ui-state-default">Item 4</li>
<li class="ui-state-default">Item 5</li>
<li class="ui-state-default">Item 6</li>
<li class="ui-state-default">Item 1</li>
</ul>
<ul class="connectedSortable">
<li class="ui-state-highlight">Item 2</li>
<li class="ui-state-highlight">Item 3</li>
<li class="ui-state-highlight">Item 4</li>
<li class="ui-state-highlight">Item 3</li>
<li class="ui-state-highlight">Item 5</li>
<li class="ui-state-default">Item 6</li>
</ul>