Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

all-or-nothing selector for checkbox groups #42

Closed
HarlanH opened this issue Nov 16, 2012 · 3 comments
Closed

all-or-nothing selector for checkbox groups #42

HarlanH opened this issue Nov 16, 2012 · 3 comments
Milestone

Comments

@HarlanH
Copy link

HarlanH commented Nov 16, 2012

Would love the checkboxGroupInput to (optionally) have a select all/select none box associated with the group.

@yihui
Copy link
Member

yihui commented Jan 10, 2014

I think you can achieve this by updateCheckboxGroupInput(). An example:

myChoices <- letters[1:5]
runApp(list(
  ui = basicPage(
    checkboxGroupInput('foo', 'FOO', myChoices),
    checkboxInput('bar', 'All/None')
  ),
  server = function(input, output, session) {
    observe({
      updateCheckboxGroupInput(
        session, 'foo', choices = myChoices,
        selected = if (input$bar) myChoices
      )
    })
  }
))

@yihui yihui closed this as completed Jan 10, 2014
@yanshil
Copy link

yanshil commented Mar 13, 2017

I love this! An elegant solution!

@larmarange
Copy link

Could it be relevant to reopen that suggestion?

When using shiny with flexdashboard, it would be easier for basic users to have a simple option directly within checkboxGroupInput ().

Best regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants