consecutive checkboxinput shiny

10 views
Skip to first unread message

auroatle

unread,
Jan 9, 2017, 12:24:53 PM1/9/17
to shinyapps.io Users
Hello.

I need to create a shiny app where only consecutive box can be selected from checkbox Input. It means that, in the code below, If I select "f" then I am able to select just "e" and "g" and so on. Any idea?

library(shiny)
campaigns_list <- letters[1:10]

ui =fluidPage(
  checkboxGroupInput("campaigns","Choose campaign(s):",campaigns_list),
  actionLink("selectall","Select All")
)
server = function(input, output, session) {
 
  observe({
    if(input$selectall == 0) return(NULL)
    else if (input$selectall%%2 == 0)
    {
      updateCheckboxGroupInput(session,"campaigns","Choose campaign(s):",choices=campaigns_list)
    }
    else
    {
      updateCheckboxGroupInput(session,"campaigns","Choose campaign(s):",choices=campaigns_list,selected=campaigns_list)
    }
  })
}
runApp(list(ui = ui, server = server)
)


Thank you very much!

Joshua Spiewak

unread,
Jan 10, 2017, 10:15:02 AM1/10/17
to auroatle, Shiny - Web Framework for R
Sounds like a general Shiny question, so forwarding along to the shiny-discuss group.

--
You received this message because you are subscribed to the Google Groups "shinyapps.io Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shinyapps-use...@googlegroups.com.
To post to this group, send email to shinyap...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/shinyapps-users/e1a279e6-e7f1-40cb-8342-2c4e17d9e8ec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages