我如何使用 shinyalert 而不是 modalDialog
How I can use shinyalert instead of modalDialog
我有一个带有一些按钮的闪亮应用程序。当我点击按钮时,我得到一个弹出窗口 window。
这是代码:
library(shiny)
library(shinyBS)
ui<-fluidPage(
actionButton("tabBut", "View Table"),
)
server<-function(input, output){
observeEvent(input$tabBut, {
showModal(
modalDialog(
title = 'Modal Example',
footer = tagList(
actionButton("done", "Some button for Done"),
modalButton('Close')
)
)
)
})
}
shinyApp(ui=ui,server=server)
我想使用 shinyalert 而不是 modalDialog。
当我点击按钮时,我想得到这个弹出窗口 window:
shinyalert(
title = "Hello",
text = "This is a modal",
size = "s",
closeOnEsc = TRUE,
closeOnClickOutside = FALSE,
html = FALSE,
type = "success",
showConfirmButton = TRUE,
showCancelButton = FALSE,
confirmButtonText = "OK",
confirmButtonCol = "#AEDEF4",
timer = 0,
imageUrl = "",
animation = TRUE
)
可能吗?我该怎么做?
library(shiny)
library(shinyalert)
ui <- fluidPage(
useShinyalert(),
actionButton("btn", "Click me")
)
server <- function(input, output, session) {
observeEvent(input$btn, {
shinyalert(
title = "Hello",
text = "This is a modal",
size = "s",
closeOnEsc = TRUE,
closeOnClickOutside = FALSE,
html = FALSE,
type = "success",
showConfirmButton = TRUE,
showCancelButton = FALSE,
confirmButtonText = "OK",
confirmButtonCol = "#AEDEF4",
timer = 0,
imageUrl = "",
animation = TRUE
)
})
}
shinyApp(ui, server)
我有一个带有一些按钮的闪亮应用程序。当我点击按钮时,我得到一个弹出窗口 window。 这是代码:
library(shiny)
library(shinyBS)
ui<-fluidPage(
actionButton("tabBut", "View Table"),
)
server<-function(input, output){
observeEvent(input$tabBut, {
showModal(
modalDialog(
title = 'Modal Example',
footer = tagList(
actionButton("done", "Some button for Done"),
modalButton('Close')
)
)
)
})
}
shinyApp(ui=ui,server=server)
我想使用 shinyalert 而不是 modalDialog。 当我点击按钮时,我想得到这个弹出窗口 window:
shinyalert(
title = "Hello",
text = "This is a modal",
size = "s",
closeOnEsc = TRUE,
closeOnClickOutside = FALSE,
html = FALSE,
type = "success",
showConfirmButton = TRUE,
showCancelButton = FALSE,
confirmButtonText = "OK",
confirmButtonCol = "#AEDEF4",
timer = 0,
imageUrl = "",
animation = TRUE
)
可能吗?我该怎么做?
library(shiny)
library(shinyalert)
ui <- fluidPage(
useShinyalert(),
actionButton("btn", "Click me")
)
server <- function(input, output, session) {
observeEvent(input$btn, {
shinyalert(
title = "Hello",
text = "This is a modal",
size = "s",
closeOnEsc = TRUE,
closeOnClickOutside = FALSE,
html = FALSE,
type = "success",
showConfirmButton = TRUE,
showCancelButton = FALSE,
confirmButtonText = "OK",
confirmButtonCol = "#AEDEF4",
timer = 0,
imageUrl = "",
animation = TRUE
)
})
}
shinyApp(ui, server)