problems of renderDataTable under shiny 0.11.1

607 views
Skip to first unread message

Jie Song

unread,
Mar 23, 2015, 10:19:12 AM3/23/15
to shiny-...@googlegroups.com

Hi,

When I update to the shiny version 0.11.1, all my dataTable doesn't work, it gives me the error message that "DataTables warning: table id=DataTables_Table_0 - Ajax error. For more information about this error, please see http://datatables.net/tn/7"
I tried different ways but still can't solve the problem.

Interesting thing is, I  found that if I put .ui and .server in one script, like the following, it works.
  shinyApp(
    ui = fluidPage(
      fluidRow(
        column(12,
          dataTableOutput('table')
        )
      )
    ),
    server = function(input, output) {
      output$table <- renderDataTable(iris)
    }
  )

But if I put them in separate scripts, which I think is exactly the same as above, it doesn't work. (Sometimes when I run the app first time, especially before the first example was ran, it works, when I run it again, it doesn't work and throws out the error.)

ui.R

shinyUI(fluidPage(
      fluidRow(
        column(12,
          dataTableOutput('table')
        )
      )
))

server.R
shinyServer(function(input, output) {
  output$table <- renderDataTable(iris)
})

I tested the above examples in shiny 0.11, both examples work. BTW, I am using Rstudio 3.1.1, could it be the reason?

Thanks,
Jie

Yihui Xie

unread,
Mar 23, 2015, 6:24:51 PM3/23/15
to Jie Song, shiny-discuss
That is really odd. You are not the only person who has reported this
issue, but I have not been able to reproduce it. Could you upgrade to
R 3.1.3 and try again if it is not too inconvenient for you? I doubt
that could be the reason, though. BTW, can you also post the output of
library(shiny);sessionInfo() in R, along with the web browser version
that you were using?

The long-term plan is to move DataTables out of shiny to the new DT
package (http://rstudio.github.io/DT/). Can you install the
development versions of shiny and DT, and see if the warning is still
there? Thanks!

devtools::install_github(c('rstudio/shiny', 'rstudio/DT'))

The app will have to be modified a little bit:

# ui.R

shinyUI(fluidPage(
fluidRow(
column(12,
DT::dataTableOutput('table')
)
)
))

# server.R
library(DT)
shinyServer(function(input, output) {
output$table <- DT::renderDataTable(datatable(iris))
})

Regards,
Yihui
> --
> You received this message because you are subscribed to the Google Groups
> "Shiny - Web Framework for R" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to shiny-discus...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/shiny-discuss/8eac82dc-79cf-421f-bf97-1043b8a21c36%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages