from shiny import App, Inputs, Outputs, Session, module, reactive, ui
@module.ui
def reprex_selectize_ui(label: str):
return ui.input_selectize("x", label, choices=[], multiple=True)
@module.server
def reprex_selectize_server(
input: Inputs, output: Outputs, session: Session, server: bool = True
):
@reactive.effect
def _():
ui.update_selectize(
"x",
choices=[f"Foo {i}" for i in range(3)],
server=server,
options={"placeholder": "Search"},
)
app_ui = ui.page_fluid(
reprex_selectize_ui("serverside", "Server"),
reprex_selectize_ui("clientside", "Client"),
)
def server(input: Inputs, output: Outputs, session: Session):
reprex_selectize_server("serverside", server=True)
reprex_selectize_server("clientside", server=False)
app = App(app_ui, server, debug=True)
update_selectize()has inconsistent behavior.When
server=True, there are two remove buttons.When
server=Falsethere are no remove buttons.We need to decide what the behavior should be when you specify
optionsinupdate_selectize().Should this add additional options to some default list?
Replace the list entirely?
Recommend we:
The test app here will reproduce both of the mentioned scenarios: