Reputation: 13
i've seen several entries regarding this issue and have tried several of them, but nothing has worked without either an error or just not at all...
i have a checkbox group in my shiny dashboard body
checkboxGroupInput("dbr", selected = NULL,
h4("Select Data Breach Rating"),
c(
"Low" = "Low",
"Medium" = "Medium",
"High" = "High",
"Critical" = "Critical"
# End check list
),
# End check group
),
i also have a reset button in the dashboard body using an action button
actionButton("reset_artifact_entry", label = "Reset")
in the server portion of the code i have an observeEvent
server <- function(input, output, session) {
# Rest button for artifact entry page
observeEvent(input$reset_artifact_entry, {
updateCheckboxGroupInput(session, "dbr", selected = NULL)
})
I'm sure the problem is in how i have this set up... when i run the code i get no errors, but when i click the button nothing happens either...
cheers ~!
Upvotes: 0
Views: 541
Reputation: 359
You just need to add the same choices inside you updateCheckboxGroupInput
and then it will work. See below.
library(shiny)
ui <- fluidPage(
wellPanel(checkboxGroupInput("dbr", selected = NULL,
h4("Select Data Breach Rating"),
c("Low" = "Low",
"Medium" = "Medium",
"High" = "High",
"Critical" = "Critical")),
actionButton("reset_artifact_entry", label = "Reset")
)
)
server <- function(input, output, session) {
# Rest button for artifact entry page
observeEvent(input$reset_artifact_entry, {
updateCheckboxGroupInput(session, "dbr", choices = c(
"Low" = "Low",
"Medium" = "Medium",
"High" = "High",
"Critical" = "Critical"), selected = NULL)})
}
shinyApp(ui, server)
Upvotes: 1