When I use the insertUI function to add a new dropdown button, there will be a strange bug that the added one won't be triggered in anyway.
library(shiny)
library(shinyWidgets)
ui <- fluidPage(
dropdown(
label = "old",
inputId = "old",
tagList(
selectInput("s1","s1","1"),
selectInput("s2","s2","1")
)
),
actionButton("epiDataPanelAddBtn","add"),
actionButton("epiDataPanelDesBtn","des")
)
server <- function(input, output, session) {
observeEvent(input$epiDataPanelAddBtn,{
insertUI(
selector = paste0("#epiDataPanelAddBtn"),
where = "afterEnd",
ui = dropdown(
label = "new",
inputId = "new",
tagList(
selectInput("s1","s1","1"),
selectInput("s2","s2","1")
)
),
session = session
)
})
observeEvent(input$epiDataPanelDesBtn,{
})
}
shinyApp(ui, server)
You can find that the 'old' dropdown can be triggered by click, while 'new' dropdown won't.
That's very strange.
Is there any method to solve this ?
Thank you
Dy