UI Sortables, Droppables and Dragging
Hi,
Basically I have muddled together a sortable list that is also a
droppable list. I have some draggable elements that I drop/clone on
the list and it all works. I have buttons on the sortable list to move
the elements up and down which disable when they get to either the top
or bottom of the list.
Now the problem is when you drag the sortable list elements the code
that updates the disabling of the up/down links doesn't seem to work
(does using the buttons though). So you end up with for example if you
have 3 items in the list, you drag the bottom item to the middle and
it stays with the down button still disabled - the new bottom item
should have its down button disabled.
Here's the code I'm using the update the buttons and is set in the
options of the sortable (update: updateUpDown, change: updateUpDown):
var updateUpDown = function(sortable){
$('dl:not(.ui-sortable-helper)', sortable)
.removeClass('first').removeClass('last')
.find('.up').removeClass('updisabled').end()
.find('.down').removeClass('downdisabled').end()
.filter(':first').addClass('first').find('.up').addClass('updisabled').end().end()
.filter(':last').addClass('last').find('.down').addClass('downdisabled').end().end();
};
How can I get this code to work if the sortable item is dragged into a
new position in the list?
Thanks,
Nick