-
Notifications
You must be signed in to change notification settings - Fork 7
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
Remove items from a sortable list #24
Comments
Hi Phaet, thanks for checking out this plugin. I have no immediate solution for your question. I would probably start by adding a "remove" or "trash" button to the sortable items to remove them by clicking that button. If that's not an option I'd try to register a droptarget (every sortable is also a draggable) or add a custom event handler for mouserelease events. I'll try to come up with a small prototype but maybe these ideas can already help you out. Cheers! |
Hi Gardiner, I really appreciate your thoughts and effort. |
Well, I have tried for a while now and it does not seem to be easily achievable with this lib. The main problem is that while dragging a clone of the dragged element is positioned at the mouse pointer which makes checking for a possible drop target tricky. You can overcome this by adding
It is working, but not very elegant... sorry. Cheers! |
Hey, this looks like a solution. I'm going to try it asap. Just one more thought: You were saying that sortable elements are naturally draggable. So I wonder, why sortable does not provide the droptarget and drop options (inherited from draggable)? |
Yeah that was my initial thought. But apparently I hadn't considered that possibility when writing the lib, so it doesn't work this way in its current state. But I'm definitely considering to integrate this possibility into an upcoming version! Cheers! |
Great! Looking forward to it then. |
I found now a rather simple solution consisting of two grouped lists, one of which is the waste bin and initially empty. When pressing Upload, only the images in the first list are uploaded, while the others are ignored. Or in case images already uploaded to the server, those in the waste bin are deleted from the server. |
Clever, I like it! Straightforward and no hacks needed :) Thanks for letting me know! Cheers. |
I created now a sortable list of thumbnails. This works like charm. 😀
I want also to allow users to remove a thumbnail from the list, either by just dragging the thumb outside the parent container or to another container, working as "waste bin".
For the latter, I tried to apply .draggable simultanously to the sortable items with a callback function for the drop target.
But this does not work. (Of course, should I say).
Is there a way I could accomplish this remove function one or the other way?
(I must admit that my js knowledge is too limited to understand what's going on in the draganddrop.js.)
The text was updated successfully, but these errors were encountered: