I am working on a pretty "big" dataset that takes at least 20 seconds to be read entirely at the launch of my Shiny
app. I would like to display a pop-up waiting message like the one below during this reading time, which will close automatically when it is done.
However, I have no idea how to specify a condition to automatically close the alert. Below is what I have done so far:
server <- function(input, output, session) {
data = read_sav("BS.SAV")
shinyalert(
title = "Wait",
text = "Waiting for data loading",
size = "xs",
closeOnEsc = TRUE,
closeOnClickOutside = TRUE,
html = TRUE,
type = "info",
showConfirmButton = TRUE,
confirmButtonText = "OK",
confirmButtonCol = "#004192",
showCancelButton = FALSE,
imageUrl = "",
animation = TRUE
)
}
Here is one example. Using the below code, we attach an
onInput
attribute on thefileInput
which sets a certainInputValue
when the upload starts.The change of this
InputValue
triggers anobserveEvent
which displays the alert. The output gets then rendered into aDT::datatable
and when this object is finally rendered, the alert gets closed (CloseAlert()
), see the full example below.