Table output with the JavaScript DataTables library
dataTableOutput(outputId) renderDataTable( expr, options = NULL, searchDelay = 500, callback = "function(oTable) {}", escape = TRUE, env = parent.frame(), quoted = FALSE, outputArgs = list() )
Arguments
outputId |
output variable to read the table from |
---|---|
expr |
An expression that returns a data frame or a matrix. |
options |
A list of initialization options to be passed to DataTables, or a function to return such a list. You can find a complete list of options at https://datatables.net/reference/option/. Any top-level strings with class |
searchDelay |
The delay for searching, in milliseconds (to avoid too frequent search requests). |
callback |
A JavaScript function to be applied to the DataTable object. This is useful for DataTables plug-ins, which often require the DataTable instance to be available. |
escape |
Whether to escape HTML entities in the table: |
env |
The parent environment for the reactive expression. By default,
this is the calling environment, the same as when defining an ordinary
non-reactive expression. If |
quoted |
If it is |
outputArgs |
A list of arguments to be passed through to the implicit
call to |
Description
Please use
DT::renderDataTable()
.
(Shiny 0.11.1)
Makes a reactive version of the given function that returns a data frame (or matrix), which will be rendered with the DataTables library. Paging, searching, filtering, and sorting can be done on the R side using Shiny as the server infrastructure.
This function only provides the server-side version of DataTables (using R to process the data object on the server side). There is a separate DT that allows you to create both server-side and client-side DataTables, and supports additional features. Learn more at https://rstudio.github.io/DT/shiny.html.
Examples
## Only run this example in interactive R sessions 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.');}") ) ) } ) }