-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
selectizeInput placeholder goes away when multiple = FALSE #1182
Comments
It looks like this can be solved in a somewhat-backward way by setting multiple = TRUE but including the selectize.js option maxItems = 1. The placeholder remains, but the number of items is still capped at 1, as if effectively multiple = FALSE.
|
@mdec your solutions seems like a workaround, my guess is that the developers may want to fix the underlying bug. |
Yes, I'll reopen, because it sounds like it's worth fixing. |
It turns out you can get the placeholder by using |
did not work for me. I had to use the workaround. But the workaround does not allow me to implement typing with only one option when updating the UI with
A "clean" solution would be preferable IMO |
@AnimeSana Agreed, I'm having the exact same issue when attempting to add a placeholder using updateSelectizeInput(). |
Any update on this? The annoying part is that emptying the selection leaves you with "" instead of NULL, irrespective of the the placeholder workaround. selectInput() doesn't display this behavior/bug, but server-side processing is required by my application. |
When a selectizeInput with a placeholder, choices = NULL, selected = NULL, and multiple = FALSE is updated to have a set of choices with length > 0, the placeholder disappears and the first element of choices becomes the selected value. I want the placeholder to remain and selected = NULL, since only the choices were updated, not the selected argument.
However, if multiple = TRUE, when choices are added the placeholder remains and selected remains NULL.
Below is a minimal example: when the UI loads, the selectizeInput has a placeholder, choices = NULL and multiple = FALSE. When you check the box, the server updates the choices to be c("var1", "var2", "var3", but does NOT update selected, yet the placeholder disappears and "var1" is selected by default. This happens even if I specify selected = NULL in the updateSelectizeInput call.
Is this a bug or intended? Is there a way to keep a placeholder and nothing selected with multiple = FALSE?
The text was updated successfully, but these errors were encountered: