shiny 1.3.2 renderDataTable() can't work now

My shiny version is 1.3.2
R version is 3.6,1

When I run renderDataTable {shiny} Examples, the code can't work

if (interactive()) {
    # pass a callback function to DataTables using I()
    shinyApp(
        ui = fluidPage(
            fluidRow(
                column(12,
                       dataTableOutput('table')
                )
            )
        ),
        server = function(input, output) {
            output$table <- renderDataTable(iris,
                                            options = list(
                                                pageLength = 5,
                                                initComplete = I("function(settings, json) {alert('Done.');}")
                                            )
            )
        }
    )
}

There is an open issue for this and a solution on its way, but if you are in a hurry you can solve this by replacing shiny::renderDataTable() and shiny::dataTableOutput() by the DT versions DT::renderDataTable() and DT::dataTableOutput()

2 Likes

Thanks, @andresrcs. I use DT::renderDataTable() and have solved the problem now. :heart:

Hi, @andresrcs . Today I update shiny 1.3.2 to 1.4.0 and shiny::renderDataTable() can work now. You might as well try it.

Check the GitHub issue, they said

we may likely be deprecating shiny::dataTableOutput() and shiny::renderDataTable() in a future version, so I'd suggest moving to the DT version

So I think is better to stick with DT to anticipate any breaking changes.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.