rstudio / sortable

R htmlwidget for Sortable.js
https://rstudio.github.io/sortable/
Other
130 stars 30 forks source link

Feature request: allow multiple entity select via Ctrl/Shift-click action #54

Closed leungi closed 4 years ago

leungi commented 4 years ago

Thanks for this amazingly fun (and useful) 📦!

We used this within a Shiny app recently, and the response was very positive, before the data (to pick from) got longer; at this point, users find it labourious to drag tiles one-by-one, and requested ability to select multiple items at once.

Looking at sortable JS docs, there is a multi-drag plugin; hope it'll be implemented in R wrapper in the near future 🙏

andrie commented 4 years ago

This is already possible, and all that's needed is to include

options = sortable_options(
    multiDrag = TRUE
  )

In addition, the CSS should be modified to make it clear that the item is selected.

rank_list(
  text = "You can drag, drap and re-order these items:",
  labels = c("one", "two", "three", "four", "five"),
  input_id = "example_2",
  options = sortable_options(
    multiDrag = TRUE
  )
)

I'm adding an example and modified CSS.

leungi commented 4 years ago

Thanks for prompt action @andrie 👍

I pulled from latest commit, but no luck. I tried Shift, Ctrl, and multi-clicks.

Package version

sortable * 0.4.2.9000 2020-06-17 [1] Github (rstudio/sortable@26acd36)

sortable-multidrag

andrie commented 4 years ago

The problem is that your version doesn't have the modified CSS, so it appears as if nothing is happening.

None of this is in the master branch yet. To pick up the work in progress, you'll need to follow along in the linked PR, and perhaps check out commit number 5d162b0823573acb63fa522146a4fdc273fd243d

andrie commented 4 years ago

Closed with #55

leungi commented 4 years ago

Thanks for clarification @andrie ; should've checked the commit log first and not assume it's pushed to master. 🙏