mercredi 14 mars 2018

R Shiny - Server rendered checkbox won't check

I'm trying to use awesomeCheckbox from the shinyWidgets package and am running into an issue where I can't check/uncheck the box that a server rendered.

library(shiny)
library(shinyWidgets)

ui <- fluidPage(
  awesomeCheckbox(inputId = "checkboxA",
                  label = "A checkbox",
                  value = TRUE),
  uiOutput("checkboxB"), 
  uiOutput("FS1")

)
server <- function(input, output) {
  output$checkboxB <- renderUI({
    awesomeCheckbox(inputId = "checkboxB",
                    label = "B checkbox",
                    value = TRUE)
  })
  output[[paste0("FS", 1)]] <- renderUI({
    awesomeCheckbox(inputId = paste0("FS", 1),label = "FS", value = FALSE)
  })
}

shinyApp(ui= ui, server=server)

I need this piece of code as part of a larger Shiny App where checkboxes are generated dynamically in the server (hence the weird paste0 naming).

I've checked my version of R and have tried using both Chrome and Safari but can't seem to get the FS checkbox to check/uncheck. I also can't seem to find anything out of the ordinary when I use "Inspect element" in my browser.




Aucun commentaire:

Enregistrer un commentaire