Bug Tracker

Ticket #2914 (new enhancement)

Opened 6 months ago

Draggable: make revert a method

Reported by: ivan Assigned to: paul
Type: enhancement Priority: minor
Milestone: 1.2.4 Component: ui
Version: 1.2.3 Keywords:
Cc: Needs: Review

Description

A pretty common need with draggables/droppables is to accept the drop, do some processing, and then, if some conditions are not met, restore the draggable to the original position.
I think it would make sense to make 'revert' callable externally (for example in the 'drop' method of the droppable).
The attached patch does that: unfortunately, at the moment it requires setting draggableInstance.cancelHelperRemoval = true; in the draggable 'stop' or in the droppable 'drop' methods, to prevent the helper from being removed too soon (see also here for a discussion).

Attachments

ui.draggable.js.patch (1.8 kB) - added by ivan 6 months ago.

Change History

Changed 6 months ago by ivan

Note: See TracTickets for help on using tickets.