DT (version 0.5)

dataTableOutput: Helper functions for using DT in Shiny

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

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

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

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

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

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.

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.

...

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

Run this code
# NOT RUN {
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)
      )
    }
  )
}
# }

Run the code above in your browser using DataCamp Workspace