Debian Codegraph @

man/renderDataTable.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/bootstrap.R, R/shinywrappers.R
3 \name{dataTableOutput}
4 \alias{dataTableOutput}
5 \alias{renderDataTable}
6 \title{Table output with the JavaScript DataTables library}
7 \usage{
8 dataTableOutput(outputId)
9
10 renderDataTable(
11 expr,
12 options = NULL,
13 searchDelay = 500,
14 callback = "function(oTable) {}",
15 escape = TRUE,
16 env = parent.frame(),
17 quoted = FALSE,
18 outputArgs = list()
19 )
20 }
21 \arguments{
22 \item{outputId}{output variable to read the table from}
23
24 \item{expr}{An expression that returns a data frame or a matrix.}
25
26 \item{options}{A list of initialization options to be passed to DataTables,
27 or a function to return such a list. You can find a complete list of
28 options at \url{https://datatables.net/reference/option/}.
29
30 Any top-level strings with class \code{"AsIs"} (as created by \code{\link[=I]{I()}}) will be
31 evaluated in JavaScript. This is useful when the type of the option value
32 is not supported in JSON, e.g., a JavaScript function, which can be
33 obtained by evaluating a character string. This only applies to the
34 root-level elements of options list, and does not worked for lower-level
35 elements in the list.}
36
37 \item{searchDelay}{The delay for searching, in milliseconds (to avoid too
38 frequent search requests).}
39
40 \item{callback}{A JavaScript function to be applied to the DataTable object.
41 This is useful for DataTables plug-ins, which often require the DataTable
42 instance to be available.}
43
44 \item{escape}{Whether to escape HTML entities in the table: \code{TRUE} means
45 to escape the whole table, and \code{FALSE} means not to escape it.
46 Alternatively, you can specify numeric column indices or column names to
47 indicate which columns to escape, e.g. \code{1:5} (the first 5 columns),
48 \code{c(1, 3, 4)}, or \code{c(-1, -3)} (all columns except the first and
49 third), or \code{c('Species', 'Sepal.Length')}.}
50
51 \item{env}{The parent environment for the reactive expression. By default,
52 this is the calling environment, the same as when defining an ordinary
53 non-reactive expression. If \code{expr} is a quosure and \code{quoted} is \code{TRUE},
54 then \code{env} is ignored.}
55
56 \item{quoted}{If it is \code{TRUE}, then the \code{\link[=quote]{quote()}}ed value of \code{expr}
57 will be used when \code{expr} is evaluated. If \code{expr} is a quosure and you
58 would like to use its expression as a value for \code{expr}, then you must set
59 \code{quoted} to \code{TRUE}.}
60
61 \item{outputArgs}{A list of arguments to be passed through to the implicit
62 call to \code{dataTableOutput()} when \code{renderDataTable()} is used
63 in an interactive R Markdown document.}
64 }
65 \description{
66 \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}}
67
68 This function is deprecated, use
69 \href{https://rstudio.github.io/DT/shiny.html}{DT::renderDT()} instead. It
70 provides a superset of functionality, better performance, and better user
71 experience.
72 }
73 \examples{
74 ## Only run this example in interactive R sessions
75 if (interactive()) {
76 # pass a callback function to DataTables using I()
77 shinyApp(
78 ui = fluidPage(
79 fluidRow(
80 column(12,
81 dataTableOutput('table')
82 )
83 )
84 ),
85 server = function(input, output) {
86 output$table <- renderDataTable(iris,
87 options = list(
88 pageLength = 5,
89 initComplete = I("function(settings, json) {alert('Done.');}")
90 )
91 )
92 }
93 )
94 }
95 }
96 \keyword{internal}