-
-
Notifications
You must be signed in to change notification settings - Fork 461
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
ability for 'acceptFrom' to accept a function as an argument #643
Comments
Hey, that sounds great. Would you be able to send a PR to include this? |
Isn't this what
|
@Barabazs @mike16889 the way I understood it, the function can be used for more complex filtering. E.g. you could check if an item is a specific type, if the text of an item starts with a It basically allows for more flexibility. |
@Barabazs @lukasoppermann exactly, you could have it check just about anything, you could have it so a sortable will only accept a drop on every even minute, or only while a specific key is held down. |
Thank you for clarifying. That would be a nice addition and I actually might have a use-case for it. |
I came across a need to be able to decide if a specific item should be accepted or not, with jQuery UI, it can be done with a function on 'accept' option which for me, works perfect, the only piece of jQuery UI i use is sortable and that has bugs and looks to no longer be maintained so I wanted to use this library.
but that functionality is not available, so I figured I would see if I can hack that functionality into html5sortable (which I am really loving btw)
You will have to excuse me as I am a bit of a novice and do not know how to use git or buildtools.
I modified
_listsConnected
to accept destination and dragging instead of destination and origin (origin = dragging.parentElement), that way the user supplied function can be passed the item being dragged for evaluation.HERE is a codepen with a working example:
The text was updated successfully, but these errors were encountered: