updateSelectInput_dsfr.Rd
updateSelectInput_dsfr
updateSelectInput_dsfr(
inputId,
label = NULL,
choices = NULL,
selected = NULL,
session = shiny::getDefaultReactiveDomain()
)
html
## Only run examples in interactive R sessions
if (interactive()) {
library(shiny)
library(shinygouv)
ui <- fluidPage_dsfr(
header = header_dsfr(
intitule = "Intitule",
officiel = "Officiel",
nom_site_service = "Nom du site / service",
baseline = "baseline - precisions sur l organisation",
class = "fr-m-1w"
),
title = "Exemple",
fluidRow_dsfr(
selectInput_dsfr(
inputId = "variable",
label = "Variable:",
choices = c(
"Cylinders" = "cyl",
"Transmission" = "am",
"Gears" = "gear"
)
)
),
fluidRow_dsfr(
actionButton_dsfr(inputId = "update", label = "update label")
),
fluidRow_dsfr(
actionButton_dsfr(inputId = "update2", label = "update choices")
),
fluidRow_dsfr(
actionButton_dsfr(inputId = "update3", label = "update selected")
)
)
server <- function(input, output, session) {
observeEvent(input$update, {
updateSelectInput_dsfr(inputId = "variable", label = "Nouveau label")
})
observeEvent(input$update2, {
updateSelectInput_dsfr(inputId = "variable", choices = LETTERS)
})
observeEvent(input$update3, {
updateSelectInput_dsfr(inputId = "variable", selected = LETTERS[12])
})
}
shinyApp(ui, server)
}