I have checkboxGroup with selected items, and actionButton. I need on actionButton click uncheck checkBoxGroup.
wellPanel(
checkboxGroupInput(datename, "Select dates:", some_dates,
selected = outlier_dates_to_select),
actionButton("buttonname", "Uncheck all")
)
Any suggestions, how I can manage that?
Thank you a lot!
You have to use actionButton
like this for example :
In ui.R :
shinyUI(pageWithSidebar(
headerPanel(title=""),
sidebarPanel(
checkboxGroupInput("Test1", "Test1", choices=c("1","2","3"), selected="1"),
checkboxGroupInput("Test2", "Test2", choices=c("1","2","3"), selected="2"),
actionButton("Uncheck", label="Uncheck")
),
mainPanel()
))
And in server.R :
shinyServer(function(input, output, session) {
observe({
if (input$Uncheck > 0) {
updateCheckboxGroupInput(session=session, inputId="Test1", choices=c("1","2","3"), selected=NULL)
updateCheckboxGroupInput(session=session, inputId="Test2", choices=c("1","2","3"), selected=NULL)
}
})
})
You have to repeat choices in updateCheckboxGroupInput
to make it work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With