Skip to main content

Search and Top Navigation

#5503 closed bug (worksforme)

Opened April 10, 2010 09:10PM UTC

Closed January 19, 2011 04:01PM UTC

Last modified October 11, 2012 09:15PM UTC

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.

Attachments (0)
Change History (3)

Changed July 30, 2010 10:55AM UTC by jzaefferer comment:1

component: ui.coreui.sortable

Changed January 19, 2011 04:01PM UTC by scottgonzalez comment:2

resolution: → worksforme
status: newclosed

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

I tested against 1.8 as well.

Changed October 11, 2012 09:15PM UTC by scottgonzalez comment:3

milestone: TBD

Milestone TBD deleted