我将modalDialog嵌入到其他modalDialog
中。当我运行modalButton
时,它们都关闭了。
如何仅关闭嵌入式modalDialog
?
library(shiny)
shinyApp(
ui <- fluidPage(
actionButton("one","Press")
),
server <- function(input, output,session) {
observeEvent(input$one,{
showModal(modalDialog(
actionButton("two","Press 2"),
footer = tagList(
modalButton("Cancel")
)))
})
observeEvent(input$two,{
showModal(modalDialog(
"OKAY",
footer = tagList(
modalButton("Cancel")
)))
})
})
答案 0 :(得分:1)
我不确定您想要以模态显示什么,但也许您可以查看sweetalertR
包:
library(shiny)
library(sweetalertR)
shinyApp(
ui <- fluidPage(
sweetalert('#one',
title = "Are you sure?",
text = "Press here for some magic",
type = "warning",
showCancelButton = TRUE,
confirmButtonColor = '#DD6B55',
confirmButtonText = 'Yes, Confirm!',
closeOnConfirm = FALSE,
evalFunction = 'function(){swal("OKAY!", "Thank you PorkChop!", "success")}'
),
actionButton("one","Press")
),
server <- function(input, output,session) { })