Open Molaison opened 1 year ago
The first time you click "run" the DT is not present on screen, waiter cannot overlay anything, subsequent time it works fine.
Consider this below if you want this to show all the time.
library(DT)
library(shiny)
ui <- fluidPage(
useWaiter(),
actionButton("run", "RUN"),
div(
style = "min-height:400px",
id = "DTtest-container",
DTOutput("DTtest")
)
)
server <- function(input, output, session) {
wtr_test <- Waiter$new(id = "DTtest-container", html = spin_dots())
DT_result <- eventReactive(input$run, {
wtr_test$show()
on.exit({
wtr_test$hide()
})
Sys.sleep(5)
iris
})
output$DTtest <- renderDT(
DT_result()
)
}
shinyApp(ui, server)
I was using
Waiter
to show a spinner before the results were calculated. But I encountered a problem that the waiter component didn't show when the data was calculated for the first time.The versions information of R and R packages I used are as follows:
To demonstrate the issue more clearly, I have prepared a shiny reprex below.