Closed pwFoo closed 7 years ago
Hi @pwFoo and thanks for using the Plugin and contributing with your question! Awesome!
So I’m not 100% sure what you mean by sortable lists. Would you mind to elaborate it? Please share your use case in detail (maybe even with dummy code example?). If it’s not yet implemented it could potentially be a good feature to add.
Thank you :)
I played with your examples and moving elements works fine, but how to sort / re-order lists like that? http://madrobby.github.io/scriptaculous/sortable-lists-demo/
Just an example to show you. nothing I'm using ;)
Hmm ok I see. So to answer your first question, this is not possible yet out of the box. You see, at first sight, sorting a list to me seems to be a completely different task than dragging and dropping stuff. So, I’m not 100% sure if it’s something the dragNdrop plugin should be able to do. I’m open to be convinced of the contrary.
If you would elaborate your specific use case, I might be able to see if/how to tackle it and weight up the effort.
The more you tell me the better I can help and the better I can improve the plugin to meet your needs.
Now, if you absolutely want to do this with the dragNdrop plugin, you would have to write a little bit of your own code: you can pass the elements of a list as drag elements and drop zone at the same time: Then, in the drop callback you would get the element back that was dragged and the zone it was dropped into (dropzone). With this information you could calculate both positions and programmatically move the dropzone to the origin position of the dragged element.
If this really is a critical usecase the plugin should solve, I’m willing to have it implemented, that however would take some days. So for now I would suggest to use the dragNdrop to drag and drop stuff and use a specific list sorting plugin to sort lists. This one here is quite popular: (https://github.com/RubaXa/Sortable). If you need both, you can totally use both.
By the way, if you feel confident adding the feature, you’re always welcome to create a pull request.
I think you're right. You're plugin works as should and the sortable list use case need another plugin!
Thanks for sharing the link to sortable. I'll take a look. I should search for sortable plugins and compare which is the best and small in size plugin for the sortable feature.
For now it’s out of scope. Such a "swapout" functionality or even sorting might come in future tho’. Thanks @pwFoo for your input, very much appreciated 👍
If anyone else wish to have a sortable list functionality give this comment a thumb up and please write your use case in here, thanks :)
I looked at the examples, but can't find sortable lists? Is it possible with dragNdrop out of the box?