dataTableOutput: Helper functions for using DT in Shiny

Description Usage Arguments References Examples

View source: R/shiny.R

Description

These two functions are like most fooOutput() and renderFoo() functions in the shiny package. The former is used to create a container for table, and the latter is used in the server logic to render the table.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
dataTableOutput(outputId, width = "100%", height = "auto")

DTOutput(outputId, width = "100%", height = "auto")

renderDataTable(
  expr,
  server = TRUE,
  env = parent.frame(),
  quoted = FALSE,
  funcFilter = dataTablesFilter,
  ...
)

renderDT(
  expr,
  server = TRUE,
  env = parent.frame(),
  quoted = FALSE,
  funcFilter = dataTablesFilter,
  ...
)

Arguments

outputId

output variable to read the table from

width

the width of the table container

height

the height of the table container

expr

an expression to create a table widget (normally via datatable()), or a data object to be passed to datatable() to create a table widget

server

whether to use server-side processing. If TRUE, then the data is kept on the server and the browser requests a page at a time; if FALSE, then the entire data frame is sent to the browser at once. Highly recommended for medium to large data frames, which can cause browsers to slow down or crash. Note that if you want to use renderDataTable with shiny::bindCache(), this must be FALSE.

env

The environment in which to evaluate expr.

quoted

Is expr a quoted expression (with quote())? This is useful if you want to save an expression in a variable.

funcFilter

(for expert use only) passed to the filter argument of dataTableAjax()

...

ignored when expr returns a table widget, and passed as additional arguments to datatable() when expr returns a data object

References

https://rstudio.github.io/DT/shiny.html

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
if (interactive()) {
  library(shiny)
  library(DT)
  shinyApp(
    ui = fluidPage(fluidRow(column(12, DTOutput('tbl')))),
    server = function(input, output) {
      output$tbl = renderDT(
        iris, options = list(lengthChange = FALSE)
      )
    }
  )
}

Example output



DT documentation built on Sept. 5, 2021, 5:22 p.m.