title: R Shiny checkboxGroupInput - select all checkboxes by click
body: <p>I have a R Shiny app that contains checkboxGroupInput, and I'm trying to create a "select all" button, using updateCheckboxGroupInput function.
  You can see the full code below, but basically I defined the cb groups like this:</p>
  
  <pre><code>checkboxGroupInput("campaigns","Choose campaign(s):",campaigns_list)
  </code></pre>
  
  <p>and then, on a button click, call the function:</p>
  
  <pre><code>updateCheckboxGroupInput(session,"campaigns","Choose campaign(s):",choices=campaigns_list,selected=campaigns_list)
  </code></pre>
  
  <p>I have an indication that the function ran, but what it does is actually UNselecting the checkboxes.
  BTW, when I put the selected upon defining the cbGroupInput it did worked, but not on the function.</p>
  
  <p>Thanks!</p>
  
  <p>this is my server.R:</p>
  
  <pre><code>library(shiny)
  source('usefulFunctions.R')
  shinyServer(function(input, output, session) {
  
    output$cascading &lt;- renderUI({
      provider_id &lt;- input$provider
      if (provider_id == "") return(NULL)
      campaigns_list &lt;&lt;- 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 &gt; 0)
      {
        print(campaigns_list)
        updateCheckboxGroupInput(session,"campaigns","Choose campaign(s):",choices=campaigns_list,selected=campaigns_list)
      }
      })
  
  
  })
  </code></pre>