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

updateSelectInput label not anymore updated in 1.2.0 #2288

Closed
dylancis opened this issue Dec 18, 2018 · 3 comments
Closed

updateSelectInput label not anymore updated in 1.2.0 #2288

dylancis opened this issue Dec 18, 2018 · 3 comments

Comments

@dylancis
Copy link

dylancis commented Dec 18, 2018

The 1.2.0 shiny example here is not working anymore in shiny 1.2.0 - the label does not get updated anymore.

Try the below code and the label remains unchanged whatever you select (A/B/C):

## Only run examples in interactive R sessions
if (interactive()) {
  
  ui <- fluidPage(
    p("The checkbox group controls the select input"),
    checkboxGroupInput("inCheckboxGroup", "Input checkbox",
                       c("Item A", "Item B", "Item C")),
    selectInput("inSelect", "Select input",
                c("Item A", "Item B", "Item C"))
  )
  
  server <- function(input, output, session) {
    observe({
      x <- input$inCheckboxGroup
      
      # Can use character(0) to remove all choices
      if (is.null(x))
        x <- character(0)
      
      # Can also set the label and select items
      updateSelectInput(session, "inSelect",
                        label = paste("Select input label", length(x)),
                        choices = x,
                        selected = tail(x, 1)
      )
    })
  }
  shinyApp(ui, server)
}

I have tried the same with shiny 1.1.0 and it worked fine, the issue happened in 1.2.0

@dylancis dylancis changed the title updateSelectInput label not anymore updated updateSelectInput label not anymore updated in 1.2.0 Dec 19, 2018
@gagecarto
Copy link

This is probably a duplicate or has the same cause as #2245. Hoping to see this resolved asap

@dylancis
Copy link
Author

You are right. Thanks very much @gagecarto

@wch
Copy link
Collaborator

wch commented Jan 2, 2019

It is indeed a duplicate of #2245, and is fixed in the development version of shiny, which you can install with:

devtools::install_github('rstudio/shiny')

@wch wch closed this as completed Jan 2, 2019
paulovcmedeiros added a commit to Hirlam/obsmon that referenced this issue Feb 25, 2021
Otherwise shiny does not allow labels to be changed. Seems like a bug in
shiny, probably related to the one reported at
<rstudio/shiny#2288>.
paulovcmedeiros added a commit to Hirlam/obsmon that referenced this issue Mar 29, 2021
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

3 participants