r - 单击时模态消失
问题描述
我的问题是在显示我的新模式时。一旦用户单击模式,它就会消失。
有没有办法解决这个问题?我试图调用下面代码中显示的所有函数。
header <- dashboardHeader(title = "Example")
body <- dashboardBody(mainPanel(DT::dataTableOutput("mytable"),
uiOutput("sd")))
ui <- dashboardPage(header, sidebar, body, skin = "red")
server = function(input, output, session)
{
mymtcars <<- mtcars
mymtcars$id <<- 1:nrow(mtcars)
output$sd <- renderUI({
lapply(seq_len(nrow(mymtcars)),
function(i)
{
bsModal(paste0("myModal", i), "Your plot", paste0("btn", i), size = "large",
dataTableOutput(paste0("plot", i)))
})
})
iris$new <- paste0("<a href=\'https://r-studio.vip.ebay.com/shiny/map-analytics/qa/app_topics/',\ target='_blank'>Click Here for Reviews</a>")
output$mytable = DT::renderDataTable({
btns <- shinyInput(actionButton, nrow(mymtcars), "btn", label = "Show modal")
DT::datatable(cbind(Pick = btns, mymtcars), escape = F,
options = list(orderClasses = TRUE,
preDrawCallback = JS("function() {
Shiny.unbindAll(this.api().table().node()); }"),
drawCallback = JS("function() {
Shiny.bindAll(this.api().table().node()); } ")))
},server = FALSE)
lapply(seq_len(nrow(mymtcars)), function(i)
{
output[[paste0("plot", i)]] <- renderDataTable(datatable(iris,escape = F, rownames = F))
observeEvent(input[[paste0("btn", i)]], {
toggleModal(session, paste0("myModal", i), "open")
print("Pressed")
})
})
}
runApp(list(ui = ui, server = server))
解决方案
推荐阅读
- circleci - 如果提交消息包含 [ci skip],如何在主分支上强制循环 ci 构建?
- appium - Appium - Driver.source() 显示 android 主页,即使屏幕上有应用程序
- python - Python - Django - 修改序列化程序中的字段
- mongodb - Mongo 查询以从集合中获取选择性字段
- symfony - 匹配原则扩展配置
- python-3.x - 无法使用 Python 显示散景图
- delphi - 为什么不按alt键的快捷方式
- typescript - 重命名从 TypeScript 内部库隐式导入的符号
- azure - 如何在 Azure 中对 SQL 数据库资源进行可用性测试?
- r - 用于多行数据的 ggplot 线图 - 与 matplot 等效的 ggplot