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

Possible to programatically cancel a drag? #528

Closed
BrennanRoberts opened this issue Sep 5, 2016 · 3 comments
Closed

Possible to programatically cancel a drag? #528

BrennanRoberts opened this issue Sep 5, 2016 · 3 comments
Labels

Comments

@BrennanRoberts
Copy link

BrennanRoberts commented Sep 5, 2016

Hi folks, thanks for your work on this library. Is it possible to programmatically cancel an in-progress drag? If not, what's the best way to determine if the component has been unmounted at drop-time so we don't try to trigger an action on a (say) deleted item?

@charlesoconor
Copy link

bump

@brianh20
Copy link

brianh20 commented Jun 13, 2018

bump

edit: I wasn't very familiar with the library when I 'bumbed' this.
in case anyone runs into the problem I had, it was the following:

I wanted to cancel a drag if a specific condition was met on drop, so you have to set up two parts:
1 - The receiver has a canDrop method, which returns true or false. You must make your canDrop return false in order to cancel the drag.
2 - Second part is that the I needed some kind of UI behavior to let the user know why this was happening: in this case you have to go to the draggable item and on the endDrag method check if it was successful by doing: if (monitor.didDrop()) which returns true or false. In my case, using the false returned let me show a modal with the information as to why it had failed.

@stale
Copy link

stale bot commented Jul 6, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Jul 6, 2019
@stale stale bot closed this as completed Jul 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants