Tob*_*bel 5 javascript modal-dialog shiny shinybs rhandsontable
我已经对这个问题进行了很多研究,但到目前为止,当使用 Shiny 的 showModal() 而不是 bsModal() 时,还没有提供解决方案。
当我第二次在模态对话框中显示rhandsontable时,显示有问题,即并非所有列都显示。
下面是一个例子:
library(shiny)
library(rhandsontable)
u <- shinyUI(fluidPage(
# Will show first pop-up
actionButton("go", "Show Table")
))
s <- shinyServer(function(input,output,session){
df <- data.frame(Wnr = 1:10)
observeEvent(input$go, {
output$table <- renderRHandsontable({
rhandsontable(df, width = "100%", height = 200)
})
showModal(modalDialog(
title = "Table",
rHandsontableOutput("table"),
footer = tagList(actionButton("go2", "Continue"),
modalButton("Stop"))
))
})
observeEvent(input$go2, {
removeModal()
# Recalculate the table, adding new columns
output$table <- renderRHandsontable({
df$AC <- 1
df$BC <- 2
rhandsontable(df, width = "100%", height = 200)
})
showModal(modalDialog(
title = "Table",
rHandsontableOutput("table"),
footer = tagList(actionButton("go2", "Continue"),
modalButton("Stop"))
))
})
})
shinyApp(u,s)
Run Code Online (Sandbox Code Playgroud)
有没有办法(可能使用JavaScript)来修复这个显示错误?似乎该$("myModal").on({"shown.bs.modal", ...})技巧不适用于闪亮的模态,因为它们的结构与来自shinyBS 包的引导模态不同。我不使用 ShinyBS 包的一个原因是我无法将自定义操作按钮添加到模态的页脚。所以如果你找到了一种用 ShinyBS 解决它的方法,我也很高兴。然而,理想情况下,我更喜欢使用 modalDialog() 的解决方案。
我感谢任何帮助!如果需要更多信息,请告诉我
| 归档时间: |
|
| 查看次数: |
378 次 |
| 最近记录: |