Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

select_group_ui does not work when column name has a space in it #103

Open
jojojojojojo2 opened this issue Aug 7, 2024 · 0 comments
Open

Comments

@jojojojojojo2
Copy link

jojojojojojo2 commented Aug 7, 2024

select_group_ui doesn't seem to work/acknowledge NAs if the column name has a space in it.

See below:

data("mpg", package = "ggplot2")
ui <- fluidPage(
  sidebarLayout(
    sidebarPanel(
      select_group_ui(
        id = "my-filters",
        params = list(
          manufacturer = list(inputId = "manufacturer", label = "Manufacturer:"),
          model = list(inputId = "model", label = "Model:"),
          trans = list(inputId = "trans", label = "Trans:"),
          class = list(inputId = "class", label = "Class:")
        ),
        vs_args = list(disableSelectAll = FALSE), 
        inline = FALSE
      )
    ),
    mainPanel(
      reactableOutput(outputId = "table")
    )
  )
)

server <- function(input, output) {
  res_mod <- select_group_server(
    id = "my-filters",
    data = reactive(mpg),
    vars = reactive(c("manufacturer", "model", "trans", "class"))
  )
  
  output$table <- renderReactable(reactable(res_mod()))
}

shinyApp(ui,server)

Changing the column name of model (so it includes a space) prevents the selectInput from working:

mpg <- mpg %>%
   mutate(model = if_else(drv == "f" | drv == "r", NA, model)) %>% 
  rename("Model with space" = "model")

I also cannot seem to pass parameters such as selected into the list(inputId = "model", label = "Model:", manufacturer = c("audi)). They seem to make no difference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant