-
Notifications
You must be signed in to change notification settings - Fork 157
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
Spinner remains visible when rendering DT #686
Comments
Hello, That's because the datatable backgound is transparent, you can change it with some CSS: tags$style(".datatables {min-height: 320px; background: #FFF;}") Note that I've better to this function in package {shinybusy}, e.g. : library(shiny)
library(shinybusy)
library(DT)
ui <- fluidPage(
tags$h2("Exemple spinners"),
actionButton(inputId = "refresh", label = "Refresh", width = "100%"),
fluidRow(
column(
width = 5, offset = 1,
block_output(DTOutput("table1"), type = "circle", svgColor = "#E41A1C", minHeight = "300px")
),
column(
width = 5,
block_output(plotOutput("plot1"), type = "hourglass", backgroundColor = "#FFFF33", messageColor = "#3ADF00", svgColor = "#3ADF00"),
block_output(plotOutput("plot2"), type = "arrows", svgColor = "#A65628")
)
)
)
server <- function(input, output, session) {
dat <- reactive({
input$refresh
Sys.sleep(3)
Sys.time()
})
lapply(
X = seq_len(2),
FUN = function(i) {
output[[paste0("plot", i)]] <- renderPlot({
dat()
plot(sin, -pi, i*pi)
})
}
)
output$table1 <- renderDT({
data <- mtcars[sample(nrow(mtcars), 20), ]
input$refresh
datatable(
data,
class = "display compact",
options = list(
dom = "t",
iDisplayLength = 10,
scrollX = TRUE
)
)
})
}
shinyApp(ui, server) |
Thanks so much @pvictor , this is a great workaround to set a background in CSS. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When using
addSpinner()
, the spinner remains visible when rendering DT (DataTables). This behavior is inconsistent with the expected behavior observed with plots.Code to reproduce:
In this example a DT and 2 plots are rendered: the spinner remains visible even after the DataTable is rendered, while the spinners for the plots hide after rendering.
Environment:
Checked in Chrome and Firefox.The text was updated successfully, but these errors were encountered: