Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

revert item to the origin place if it is outside of dropped objects #310

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

orolin
Copy link

@orolin orolin commented Feb 27, 2017

If you finish dragging element outside dropped objects, the element doesn't move to original place, just stays where the dragging finished. In some cases you want to move it to the original position.

if you want to turn on, set parameter revertFromOutside to true, for example jqyoui-droppable="{index: {{$index}}, revertFromOutside: true}"

@cavoixanha
Copy link

cavoixanha commented Jun 27, 2018

You can revert don't edit library
By edit js of property BeforeDrop
<nameBeforeDrop> is name func of Before Drop

$scope.<nameBeforeDrop> = function (e, ui) {
               if (<condition>) {
                    // something
                    $(ui.draggable[0]).draggable( "option", "revert", true );
                    $(ui.draggable[0]).draggable( "option", "revertDuration", 200 );
                    var deferred = $q.defer();
                    return deferred.promise;
                }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants