michael/multiselect

Item disappears when start dragging from the right but immediatly drop it (within the available pane)

michael opened this issue · 6 comments

Item disappears when start dragging from the right but immediatly drop it (within the available pane)

I noticed that too. I fixed it by changing:
} else if (!opts[side].sortable) {

to:
} else if (!opts[side].sortable && side !== 'available') {

Not sure if that is the best way, but it works ;)

I found another method to fix that. I commented out the line
ui.draggable.hide();
and it seems to work fine.

yes, we worked hard to make droppable and sortable work... we will take a look at this as soon as we can. For now, these fix may work, but you should also test all combinaisons of options ("droppable" and "sortable") to make sure it works for all use cases. If we can't fix this, we will simply limit the number of combinaisons for the most common use cases. You are welcome to help! :)

Making the fixes above i noticed that the 'revert' effect disapear too, so i modified the code below, adding the value 'valid' to revert property:

// make draggable
elements.each(function() {
$(this).parent().draggable({
connectToSortable: that.selectedList,
helper: _dragHelper,
appendTo: that.container,
containment: that.container,
revert: 'valid'
});
});

Any update on this?

I fixed it by checking the class of the parent. I really wanted to figure out how to get it to use a revert animation, but I think you'd need that logic to be in the draggable and I wasn't sure how to handle a drop event from within the dragable context, so I just gave up. I'd love to see an implementation of this that got the revert animation in there, too.

// received an item from a sortable to a droppable
} else if (!opts[side].sortable) {
if (ui.draggable.parent().hasClass(side)) {
return false;
} else {
setTimeout(function(){
ui.draggable.hide();
that._setSelected(ui.draggable, itemSelected);
}, 10);
}
}