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

maxOptions can be overridden by the "Select All" button when actionsBox = TRUE #595

Closed
yogat3ch opened this issue Apr 21, 2023 · 2 comments

Comments

@yogat3ch
Copy link

A workaround is to disappear the "Select All" button assuming you have only a single instance of the widget on your page for which you don't want "Select All" to be an option. You can do so by adding the following as the option for selectAllText. Not super elegant but it works

pickerInput(
    inputId = "Id083",
    label = "Multiple", 
    choices = attr(UScitiesD, "Labels"),
    multiple = TRUE,
    options = shinyWidgets::pickerOptions(
        maxOptions = 4,
        actionsBox = TRUE,
        selectAllText = HTML(htmltools::doRenderTags(tags$style("button.actions-btn.bs-select-all {display:none;}")))
    )   
)
@pvictor
Copy link
Member

pvictor commented May 3, 2023

Hello,
Yes this is an issue in the bootstrap-select library, this has been reported here.
There's no soultion yet, the workaround suggested is to hide the select all button as you do. Note that you can put the CSS anywhere in your UI and that it will affects all pickerInput.

Victor

@pvictor pvictor closed this as completed May 3, 2023
@yogat3ch
Copy link
Author

yogat3ch commented May 4, 2023

Ah, thanks for investigating that @pvictor! Indeed, the code in the demo will effect all of the pickerInputs if the CSS selector targets the class that they all share. The selector could be prefaced with the ns(id) in the selector if we wanted to target just this instance like so (adding this just in case other folks land on this issue):

pickerInput(
    inputId = "Id083",
    label = "Multiple", 
    choices = attr(UScitiesD, "Labels"),
    multiple = TRUE,
    options = shinyWidgets::pickerOptions(
        maxOptions = 4,
        actionsBox = TRUE,
        selectAllText = HTML(htmltools::doRenderTags(tags$style(glue::glue("#{id} button.actions-btn.bs-select-all {display:none;}"))))
    )   
)

Thank you!

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

2 participants