In the sidebar of my Shiny app, I am looking to offer filtering by the values of a certain variable only when a checkbox activating that filter has been checked before. I am trying to implement this as follows:
checkboxInput("filterByDistrict", "Activate filtering by district", FALSE),
conditionalPanel(
condition = "input.filterByDistrict == true",
checkboxGroupInput(
"districts",
label = "Choose a district:",
choices = choicesList,
selected = choicesList
)
)
What I found is that the districts
input variable never gets initiated. I am using it on the server side, where the check for its existence always fails:
...
if(exists(input$districts)) {
...
What am I missing/doing wrong?