2

I tried using the cssloader package with the DT package but get the error

Warning: Error in datatable: 'data' must be 2-dimensional (e.g. data frame or matrix)

Is there another way to add a loading spinner that will work with renderDT ? Maybe a conditional panel that hides/shows?

Any help appreciated!

Ellie
  • 415
  • 7
  • 16
  • Please provide [a reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) – A. Suliman Aug 02 '18 at 18:15

1 Answers1

3

Here is a working example for DT with shinycssloaders

library(shiny)
library(DT)
library(shinycssloaders)
shinyApp(
  ui = fluidPage(fluidRow(column(12,withSpinner(DT::DTOutput('tbl'))))),
  server = function(input, output) {
    Sys.sleep(2)
    output$tbl = renderDT(
      iris, options = list(lengthChange = FALSE)
    )
  }
)
A. Suliman
  • 12,923
  • 5
  • 24
  • 37
  • 1
    Wow... I've been searching for this feature for months now. Thanks for providing a dynamic answer for replicating in any UI element. – Vedha Viyash Oct 08 '18 at 08:29