dropdown does not work if added with insertUI in Shiny R. Please help making it work.
Here is the minimal example code demonstrating the issue:
library(shiny)
library(shinyWidgets)
ui <- fluidPage(
dropdown(textInput("text", label = NULL, value = "text"),
icon = icon("table"), label = "works"),
actionButton("add", "Add content to div2"),
div(id = "div2")
)
server <- function(input, output, session) {
observeEvent(input$add, {
insertUI(selector = "#div2",
where = "beforeEnd",
ui = dropdown(textInput("text", label = NULL, value = "text"),
icon = icon("table"), label = "does not work"))
})
}
shinyApp(ui = ui, server = server)