Closed giadasp closed 2 years ago
Let me explore how this functionality could be integrated with waiter. (sorry for the late response)
I just added this to the dev version from Github: withWaiter
Reinstall the latest version
# install.packages("remotes")
remotes::install_github("JohnCoene/waiter")
Try
library(shiny)
library(waiter)
ui <- fluidPage(
useWaiter(),
actionButton("draw", "plot"),
withWaiter(
plotOutput("plot")
)
)
server <- function(input, output, session){
output$plot <- renderPlot({
input$draw
Sys.sleep(5)
plot(cars)
})
}
shinyApp(ui, server)
I'm assuming this is sorted and closing, feel free to reopen if it is not
When are you going to update the package on CRAN?
The latest version 0.2.4
includes withWaiter
. What are you after?
Hi Jhon, the new functionality is very good. However it doesn't work for me for plotly or DT.
Here is an example with plotly.
`library(shiny) library(waiter)
ui <- fluidPage( useWaiter(), actionButton("draw", "plot"), withWaiter( plotlyOutput("plot")) )
server <- function(input, output, session){ output$plot <- renderPlotly({ input$draw Sys.sleep(5) x <- c(1:100) random_y <- rnorm(100, mean = 0) data <- data.frame(x, random_y) plot_ly(data, x = ~x, y = ~random_y, type = 'scatter', mode = 'lines') }) }
shinyApp(ui, server)`
Does it already works with plotly? Cause I also can not get it to work
Dear waiter developers, I find your package really awesome but I cannot figure out how I can reproduce the
withSpinner
function of theshinycssloader
package. I display output elements dinamically so I cannot use their ids to assign a waiter to them. I tried to useautoWaiter()
but it works only for output elements for which I call arenderPlot
function. It seems it does not work for generic output elements likeoutputUI
. I make an example: Before, I created a div in this way:tags$div(withSpinner(uiOutput("output_name")))
and when I call
output$output_name <- renderUI(tags$div("hello"))
the spinner appears and it hides when the UI is rendered.
Since I want to use only your package for this kind of tasks, I'm asking you if there is a way to reproduce this behaviour. Thanks.
Giada