Opened 9 years ago

Closed 8 years ago

Last modified 6 years ago

#5503 closed bug (worksforme)

Sortable dynamic canceling does not work

Reported by: jostheim Owned by:
Priority: minor Milestone:
Component: ui.sortable Version: 1.8
Keywords: sortables Cc:
Blocked by: Blocking:

Description

I setup the following sortable:

$('#child_container_'+this.unique_id).sortable({

connectWith: '.child_container', appendTo: $(".ui-finder-container"), opacity: .5,

zIndex: 100, helper: 'clone', revert: 'invalid',

receive: function(event, ui) {

debug(ui.sender); debug($(this)); if(ui.sender.find("#"+$(this).attr('id')).length > 0 ) {

ui.sender.remove();

} else {

debug("attempting to cancel"); $(ui.sender).sortable('cancel'); $(this).sortable('cancel'); ui.sender.remove(); display_message("You dragged a parent onto a child, which would remove the parent and child from the interaction entirely");

alert("You dragged a parent onto a child, which would remove the parent and child from the interaction entirely");

}

}

});

$('#child_container_'+this.unique_id).disableSelection()

When I drag from a valid sortable to another (I have connectable sortables), the receive function is fired and I see the "attempting to cancel" message, but the drop is performed, nothing is reverted, and basically nothing is cancelled.

From the documentation at:

http://jqueryui.com/demos/sortable/

"Cancels a change in the current sortable and reverts it back to how it was before the current sort started. Useful in the stop and receive callback functions.

If the sortable item is not being moved from one connected sortable to another:

$(this).sortable('cancel'); will cancel the change.

If the sortable item is being moved from one connected sortable to another:

$(ui.sender).sortable('cancel'); will cancel the change. Useful in the 'receive' callback."

Therefor I assumed that in receive when I cancel the change that the ui would revert back, but this does not happen.

Change History (3)

comment:1 Changed 9 years ago by Jörn Zaefferer

Component: ui.coreui.sortable

comment:2 Changed 8 years ago by Scott González

Resolution: worksforme
Status: newclosed

This works fine for me: http://jsbin.com/ulibu5/edit

I tested against 1.8 as well.

comment:3 Changed 6 years ago by Scott González

Milestone: TBD

Milestone TBD deleted

Note: See TracTickets for help on using tickets.