我正在使用 Shiny 模态对话框向用户显示绘图。每当用户点击应用中的输入按钮时,就会显示模态对话框。
然而,这个情节是相当静态的。如果用户想查看新数据或用某些参数修改这些数据,则需要关闭对话框并输入新参数,然后重新生成绘图。
如何在对话框中添加输入控件?截至目前,我唯一的按钮是下载按钮,我是这样实现的:
showModal(
modalDialog(
body = plotOutput(ns("plot")),
footer = downloadButton(ns("downloadPlot")),
easyClose = TRUE,
size = "l"
)
)
那么我该如何添加第二个输入按钮呢?
答案 0 :(得分:1)
您的第一个参数不需要“主体”名称。您应该能够将所需数量的项目作为未命名参数传递给 modalDialog。
showModal(
modalDialog(
plotOutput(ns("plot")),
otherOutput("output1"),
otherOutput("output2"),
footer = downloadButton(ns("downloadPlot")),
easyClose = TRUE,
size = "l"
)
)
可以看到 here 可以直接传入模态体的 UI 元素。