UI sortable - when item is dragged from list B to list A the last item in A is sent to B ?
Hi
I've been searching through this forum and various others for a solution or an example but I haven't found anything so here goes ...
I've got my two lists and they're connected in the standard way, and that works fine - the items from list B are added into list A
But when list A already contains 6 elements I need to be able to remove the last list item in A and append it to the top of B
So, when I count the children items of list A and, if count>=6, how would I get the last one and remove it ?
Also, would I just be able to use the id "#
sortable2" of list B to append the item from list A ?
thanks for any help you can give
basically my code is this :
- <script>
- $(function() {
- $( "#sortable1, #sortable2" ).sortable({
- connectWith: ".connectedSortable"
- }).disableSelection();
- });
- </script>
-
-
- <h3>List A</h3>
-
- <ol id="sortable1" class="connectedSortable" style="list-style-type:decimal;">
- <li class="ui-state-default">Default first item</li>
- </ol>
-
- <h3>List B</h3>
-
- <ul id="sortable2" 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-highlight">Item 6</li>
- <li class="ui-state-highlight">Item 7</li>
- <li class="ui-state-highlight">Item 8</li>
- </ul>