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

virtualSelectInput(..., multiple = TRUE, showValueAsTags = TRUE, updateOn = "close") -> Removing tags does not have an effect on input$... #688

Open
danielhoop opened this issue Apr 10, 2024 · 1 comment

Comments

@danielhoop
Copy link

When using virtualSelectInput(..., multiple = TRUE, showValueAsTags = TRUE, updateOn = "close") and removing a single (or multiple) selected tags, input$... is not updated.

R: 4.3.3
shiny: 1.8.1.1
shinyWidgets: 0.8.4

Reproducible example

library(shiny)

#### UI ####
ui <- navbarPage(
  "Reproducible example",
  tabPanel("Example", uiOutput("uiPanelForTable"))
)

#### Panel for table ####
uiPanelForTable = quote(renderUI(tabPanel(
  "Example",
  fluidPage(
    # Sidebar layout with input and output definitions ----
    sidebarLayout(

      # Sidebar panel for inputs ----
      sidebarPanel(

        shinyWidgets::virtualSelectInput(
          inputId = "chosenValues1",
          label = "Chosen values1",
          choices = c("a", "b", "c"),
          multiple = TRUE,
          showValueAsTags = TRUE,
          updateOn = "change"
        ),

        shinyWidgets::virtualSelectInput(
          inputId = "chosenValues2",
          label = "Chosen values2 - when removing single tags, nothing happens (see output to the right)",
          choices = c("d", "e", "f"),
          multiple = TRUE,
          showValueAsTags = TRUE,
          updateOn = "close"
        )
      ),

      # Main panel for displaying outputs ----
      mainPanel(
        verbatimTextOutput("chosenValues1"),
        verbatimTextOutput("chosenValues2"),
      )
    )
  )
)))

#### Server ####
server <- function(input, output) {

  observe({
    output$chosenValues1 = renderPrint(input$chosenValues1)
    output$chosenValues2 = renderPrint(input$chosenValues2)
  })

  output$uiPanelForTable = eval(uiPanelForTable)
}

#### Run the application ####
shinyApp(ui = ui, server = server)
@pvictor
Copy link
Member

pvictor commented Apr 10, 2024

It seems there's no event triggered when a tag is removed, so currently those 2 options are not compatible unfortunately.

Victor

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