Table output with the JavaScript DataTables library — dataTableOutput

v1.7.4|Source: R/bootstrap.R, R/shinywrappers.R


[Superseded] 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


  options = NULL,
  searchDelay = 500,
  callback = "function(oTable) {}",
  escape = TRUE,
  env = parent.frame(),
  quoted = FALSE,
  outputArgs = list()



output variable to read the table from


An expression that returns a data frame or a matrix.


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

Any top-level strings with class "AsIs" (as created by I()) will be evaluated in JavaScript. This is useful when the type of the option value is not supported in JSON, e.g., a JavaScript function, which can be obtained by evaluating a character string. This only applies to the root-level elements of options list, and does not worked for lower-level elements in the list.


The delay for searching, in milliseconds (to avoid too frequent search requests).


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.


Whether to escape HTML entities in the table: TRUE means to escape the whole table, and FALSE means not to escape it. Alternatively, you can specify numeric column indices or column names to indicate which columns to escape, e.g. 1:5 (the first 5 columns), c(1, 3, 4), or c(-1, -3) (all columns except the first and third), or c('Species', 'Sepal.Length').


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 expr is a quosure and quoted is TRUE, then env is ignored.


If it is TRUE, then the quote()ed value of expr will be used when expr is evaluated. If expr is a quosure and you would like to use its expression as a value for expr, then you must set quoted to TRUE.


A list of arguments to be passed through to the implicit call to dataTableOutput() when renderDataTable() is used in an interactive R Markdown document.


## Only run this example in interactive R sessions
if (interactive()) {
  # pass a callback function to DataTables using I()
    ui = fluidPage(
    server = function(input, output) {
      output$table <- renderDataTable(iris,
        options = list(
          pageLength = 5,
          initComplete = I("function(settings, json) {alert('Done.');}")