shinyFeedback icon indicating copy to clipboard operation
shinyFeedback copied to clipboard

Feature Request/How-To: Update message on edits

Open asadow opened this issue 8 months ago • 0 comments

The message below will not update if say 6,8 is chosen, and then 6 is changed to 4.

library(shinyFeedback)
## Only run examples in interacive R sessions
if (interactive()) {
  ui <- fluidPage(
    useShinyFeedback(),
    
    selectInput(
      "exampleInput",
      "cyl",
      choices = mtcars$cyl |> unique(),
      multiple = TRUE
    )
  )
  
  server <- function(input, output) {
    observeEvent(input$exampleInput, {
      
      if (8 %in% input$exampleInput) {
        
        showFeedback(
          "exampleInput",
          text = paste0(input$exampleInput, collapse = ","),
          color = "#d9534f",
          icon = shiny::icon("exclamation-sign", lib="glyphicon")
        )
      } else {
        hideFeedback("exampleInput")
      }
      
    })
  }
  
  shinyApp(ui, server)
}

asadow avatar Jun 21 '24 14:06 asadow