You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
The text was updated successfully, but these errors were encountered:
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?
The text was updated successfully, but these errors were encountered: