Yang-Tang / shinyjqui

jQuery UI Interactions and Effects for Shiny
https://yang-tang.github.io/shinyjqui/
Other
273 stars 32 forks source link

sortableRadioButtons/sortableCheckboxGroupInput do not work when inlined #37

Closed sam-harvey closed 5 years ago

sam-harvey commented 5 years ago

It appears that when inlining these inputs the class of the input labels is changed to checkbox-inline/radio-inline, so they're not being picked up by the selector in the relevant functions.

e.g. the inline inputs are not sortable.

library(shiny)
library(shinyjqui)

ui <- fluidPage(
  sortableRadioButtons('test1', 'test', 1:3, inline = TRUE),
  sortableRadioButtons('test2', 'test', 1:3, inline = FALSE),
  sortableCheckboxGroupInput('test3', 'test', 1:3, inline = TRUE),
  sortableCheckboxGroupInput('test4', 'test', 1:3, inline = FALSE)
)

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

shinyApp(ui, server)

Because in sortableCheckboxGroupInput only .checkbox is selected, and likewise for the radioButtons.

  jqui_sortable(
    ui = shiny::checkboxGroupInput(
      inputId, label, choices, selected,
      inline, width, choiceNames,
      choiceValues
    ),
    options = list(items = ".checkbox", shiny = shiny_opt)
  )
Yang-Tang commented 5 years ago

Hi @sam-harvey, thank you so much for your contribution! I have merged your pull request.