rstudio / sortable

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

direction option does not work #88

Closed luke-mcconnell closed 1 year ago

luke-mcconnell commented 1 year ago

I am trying to arrange the labels of rank_list horizontally rather than vertically using the direction option:

library(shiny)
library(sortable)

ui <- fluidPage(
  rank_list(labels = c("/", "26", "2022", "August", "/"), 
            input_id = "rank",
            options = sortable_options(direction = "horizontal"))

)

server <- function(input, output, session) {

}

shinyApp(ui, server)

This is implemented in the sortable JS library: https://sortablejs.github.io/Sortable/#example7

luke-mcconnell commented 1 year ago

Current work around for this: https://stackoverflow.com/questions/73504019/shiny-horizontal-sortable-rank-list/73504477#73504477

andrie commented 1 year ago

The sortable.js library doesn't actually provide this. The demo you link to actually uses CSS to achieve this outcomes, and there is no option for setting direction, AFAICT.

This means the workaround you link to is in fact the way to get this to work. So it would require an enhancement request to the R package to enable this use case.