Closed shahreyar-abeer closed 4 years ago
Thank you.
Yes you can use {waiter} on any render*
and it should work, the reason it does not show in your case is for two reasons related to the fact that internally waiter checks that the element you want to overly is 50 pixels.
When waiter is first triggered uiOutput("text")
is just empty and has a height of 0px
(so even without waiter sanitising it still would not show), the second time it runs the uiOutput("text")
is populated with the <h3>
but is still not over 50 pixels.
Simplifying your code somewhat we can force the height to be over 50 pixels:
library(shiny)
library(waiter)
ui <- fluidPage(
use_waiter(),
actionButton(
inputId = "go",
label = "GO"
),
uiOutput("text", style="height:51px")
)
server <- function(input, output) {
w <- Waiter$new(id = "text")
observeEvent(input$go, {
output$text <- renderUI({
w$show()
Sys.sleep(3)
h3("{waiter} is polished!")
})
})
}
shinyApp(ui, server)
Let me know if this answers your question
Alhamdulillah.
This answers my question exactly to the point. I wonder though, why the choice of 50 pixels?
Because 1) otherwise it looks really odd 2) most spinners are around 48px high.
I see. Thanks for that.
Keep up the great work.
Hi John,
Nice work you have going on there. Truly appreciate it.
I was thinking, can we use {waiter} for other elements other than renderPlot(). So for example, I have am trying to do the following.
I see that this doesn't work.