I have an R Shiny application that contains checkboxGroupInput, and I'm trying to create a "select all" button using the updateCheckboxGroupInput function. You can see the full code below, but basically I defined the cb groups as follows:
checkboxGroupInput("campaigns","Choose campaign(s):",campaigns_list)
and then, by pressing the button, call the function:
updateCheckboxGroupInput(session,"campaigns","Choose campaign(s):",choices=campaigns_list,selected=campaigns_list)
I have an indication that the function works, but what it does is actually not displaying the flags. BTW, when I put the highlight in the definition of cbGroupInput, it really worked, but not from the function.
Thanks!
this is my .R server:
library(shiny) source('usefulFunctions.R') shinyServer(function(input, output, session) { output$cascading <- renderUI({ provider_id <- input$provider if (provider_id == "") return(NULL) campaigns_list <<- t(getCampaigns(provider_id)) tagList( checkboxGroupInput("campaigns","Choose campaign(s):", choices = campaigns_list, selected = campaigns_list), actionLink("selectall","Select All") ) }) observe({ if(is.null(input$selectall)) return(NULL) if (input$selectall > 0) { print(campaigns_list) updateCheckboxGroupInput(session,"campaigns","Choose campaign(s):",choices=campaigns_list,selected=campaigns_list) } }) })
source share