0

I have a Shiny app. Based on the uiInputs I need to compute a table and display it. Since the computation is taking a while I would like to display a "Please wait" while the computation is ongoing. COuld you suggest how this could be done?

The output panel is blank when computations is done as belowenter image description here

After the computation a table is displayed enter image description here

Please let me know how I can include a "Please wait..." in output?

Tinniam V. Ganesh
  • 1,979
  • 6
  • 26
  • 51

1 Answers1

3

For such cases you can use shinycssloaders. It is simple to apply around any output.

Here's a simple application from it's help page :

library(shiny)

ui <- fluidPage(
    actionButton("go", "Go"),
    shinycssloaders::withSpinner(
        plotOutput("plot")
    )
)
server <- function(input, output) {
    output$plot <- renderPlot({
        input$go
        Sys.sleep(1.5)
        plot(runif(10))
    })
}
shinyApp(ui, server)
Ronak Shah
  • 377,200
  • 20
  • 156
  • 213
  • Awesome! Works nicely! Thanks!!!! Wondering if it is possible to also add a message, in addition to spinner "Please wait..." – Tinniam V. Ganesh Jan 07 '21 at 06:04
  • Not a straight forward one but you can try this suggestion https://stackoverflow.com/questions/65043297/create-loading-messages-that-will-change-based-on-loading-time-of-plot-in-a-shin – Ronak Shah Jan 07 '21 at 06:44
  • thanks. I was hoping to have the spinner and some text, but not just the text. I will keep the spinner solution. Thanks a lot! – Tinniam V. Ganesh Jan 07 '21 at 07:18