Dragging between empty lists

Nov 24, 2011 at 9:05 PM

I've run into a small bug moving data between empty lists.  dragEnd does not always get called, and seems to be a bit inconsistent when it is.

On investigation the data-itemIdx is identical for each list, so the dragEnd function does not get called when an item is moved.  As a fix, I've added a data-parentIdx attribute to each list item in the init method, and then handle the change of list in the same way as changing the list position.  The updated code is below:


var changed = false;
$(lists).each(function(i) {
    $(this.container).children(opts.itemSelector).each(function(j) {
        if (parseInt($(this).attr("data-parentIdx")) != i) {
            changed = true;
            $(this).attr("data-parentIdx", i);
        if (parseInt($(this).attr("data-itemIdx")) != j) {
            changed = true;
            $(this).attr("data-itemIdx", j);

if (changed)

Thanks for such a great tool!


Dec 9, 2011 at 10:35 PM
Edited Jan 18, 2012 at 11:52 AM

Thanks for reporting this fix, will be added to next release.

Edit, released as 0.5.0: