我使用insertUI动态创建新的dragUI。不幸的是,新创建的dragUI没有按预期运行。我不能将它们拖动为从ui初始函数创建的dragUI。
library(shiny)
library(shinyDND)
ui <- fluidPage(
actionButton('insertBtn', 'Insert'),
dropUI("Box", row_n = 3, col_n = 3, style = "height: 200px; width: 700px"),
dragUI("Drag0",style = "display: inline-block; height: 100px; width: 100px",tags$a("Initial"))
)
shinyApp(ui, server = function(input, output) {
observeEvent(input$insertBtn, {
insertUI(
selector = '#Box',
where = c("afterEnd"),
ui = (dragUI(id="newDragUI",style = "display: inline-block; height: 100px; width: 100px",tags$a("new")))
)
})
})