Skip to content

Inconsistent behavior when specifying options in update_selectize() #2055

@elnelson575

Description

@elnelson575

update_selectize() has inconsistent behavior.

When server=True, there are two remove buttons.
When server=False there are no remove buttons.

We need to decide what the behavior should be when you specify options in update_selectize().
Should this add additional options to some default list?
Replace the list entirely?

Recommend we:

  • We should investigate what the current behavior is in R Shiny.
  • Resume investigation of selectInput.ts 289 and how that differs from the preceding code.

The test app here will reproduce both of the mentioned scenarios:

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)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions