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.
dataTableOutput(outputId, width = "100%", height = "auto", fill = TRUE)DTOutput(outputId, width = "100%", height = "auto", fill = TRUE)
renderDataTable(
expr,
server = TRUE,
env = parent.frame(),
quoted = FALSE,
funcFilter = dataTablesFilter,
future = FALSE,
outputArgs = list(),
...
)
renderDT(
expr,
server = TRUE,
env = parent.frame(),
quoted = FALSE,
funcFilter = dataTablesFilter,
future = FALSE,
outputArgs = list(),
...
)
output variable to read the table from
the width of the table container
the height of the table container
passed to htmlwidgets::shinyWidgetOutput()
, see
there for explanation (requires htmlwidgets > v1.5.4).
an expression to create a table widget (normally via
datatable()
), or a data object to be passed to
datatable()
to create a table widget
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
.
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
.
(for expert use only) passed to the filter
argument
of dataTableAjax()
whether the server-side filter function should be executed as a future or as a standard synchronous function. If true, the future will be evaluated according to the session's plan.
A list of arguments to be passed through to the implicit
call to dataTableOutput()
when
renderDataTable()
is used in an interactive R Markdown
document.
ignored when expr
returns a table widget, and passed as
additional arguments to datatable()
when expr
returns
a data object
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 DataLab