Here is example code with check-box group input:
library(shiny)
server <- function(input, output) {
output$Selected <- renderText({
paste(input$SelecetedVars,collapse=",")
})
}
ui <- fluidPage(
sidebarLayout(
sidebarPanel(
checkboxGroupInput("SelecetedVars", "MyList:",
paste0("a",1:5), selected = "a1")
),
mainPanel(textOutput("Selected"))
)
)
shinyApp(ui = ui, server = server)
As you you can see from image above we can select as many as we want, in this case 4 out of 5.
How can I set minimum and maximum number of ticks? I need minimum of 1 option checked and maximum of 3 options checked. i.e.: prevent unticking the last tick, and prevent ticking when 3 options were already ticked.
Aucun commentaire:
Enregistrer un commentaire