Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSS loader persisting after plot loads... #8

Open
SathiyaNManivannan opened this issue May 4, 2021 · 0 comments
Open

CSS loader persisting after plot loads... #8

SathiyaNManivannan opened this issue May 4, 2021 · 0 comments

Comments

@SathiyaNManivannan
Copy link

SathiyaNManivannan commented May 4, 2021

Hello,

Thank you so much for creating this customizable and versatile package. I am running into an issue where the css loader persists after the associated plot has loaded.

The app dynamically introduces the plot widget dynamically after a specific operations are done prior to the plotting options are introduced.

This is a minimal working example. As you can see after the plot is loaded, the css loader is still on.

library(shiny)
library(shinycustomloader)
ui <- fluidPage(
titlePanel("Old Faithful Geyser Data"),
sidebarLayout(
sidebarPanel(
sliderInput("bins",
"Number of bins:",
min = 1,
max = 50,
value = 30)
),
mainPanel(
actionButton("insertPlot", "Insert Plot")
)
)
)
server <- function(input, output) {
observeEvent(input$insertPlot,{
insertUI(selector = "#insertPlot",
where = "beforeBegin",
ui = withLoader(plotOutput("distPlot"))) #This is the place where the plot is introduced with the loader
insertUI(selector = "#bins",
where = "afterEnd",
ui = actionButton("Update", "Update"))
removeUI("#insertPlot")
})
observeEvent(input$Update,{
Sys.sleep(5)
output$distPlot <- renderPlot({
x <- faithful[, 2]
bins <- seq(min(x), max(x), length.out = input$bins + 1)
hist(x, breaks = bins, col = 'darkgray', border = 'white')
})
})
}
shinyApp(ui = ui, server = server)

Is it possible to add withLoader to ui that are dynamically introduced?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant