Closed MayaGans closed 3 years ago
I'm glad you like the package!
We already support all of the features of sortableJS
, including cloning. What you propose should be reasonably easy to achieve in a shiny
app with sortable
, probably with minimal JavaScript coding.
I'll try to make an example of this tomorrow.
I would probably go about it by adding a third column where you can drag items to delete them from the cloned list. This approach is described at https://github.com/SortableJS/Sortable/issues/193, and this links to a fiddle that no longer works, but you can see the idea.
I now have a working demo at https://andrie-de-vries.shinyapps.io/sortable_clone_remove_app/
The code is in a branch of sortable
, at https://github.com/rstudio/sortable/blob/example-clone/inst/shiny-examples/clone_remove/app.R
I would very much appreciate any feedback (or documentation pull requests) on how I can make this more discoverable.
See PR #46 - thank you so much for this!!! It might just be a personal aesthetic preference that I prefer a delete button inside the draggable element instead of having to drag it to the trash, but I can customize the code for my use case as having a trash bin might be what's more generally desired? Thanks again and feel free to close if you feel my PR addresses the documentation visibility, otherwise I'm happy to adjust!
Hi @andrie is it possible to use sortable_options when using add_rank_list() function? I'm quite new to this package and can't find the way to implement code used in this issue. I mean I can use the whole code, but I prefer aesthetics I get when using rank_list. Btw, thank you for this package, it's awesome! :)
@MayaGans, I think we can close this now, do you agree?
I firstly wanted to thank you for the great library! I've been fiddling with the JS because I'd like to add implement sortable JS's cloning with the additional ability to delete list items (I just added a button but you might have a more elegant solution?)
I made a CodePen here, but I'm only just learning how to put JS and Shiny https://codepen.io/mayagans/pen/MWYvVQx?editors=0110
I'll keep tinkering with the JS but figured it may be a feature request others would like as well.
Thanks again!