Skip to contents

Add DT datatable

Usage

add_DT(content, table_data, options = NULL, ...)

Arguments

content

A content_collection object

table_data

A DT datatable object (from DT::datatable()) OR a data frame/matrix (will be auto-converted)

options

List of DT options (only used if passing a data frame)

...

Additional arguments passed to DT::datatable() (only used if passing a data frame)

Value

Updated content_collection

Examples

if (FALSE) { # \dontrun{
# Option 1: Pass a styled DT object
my_dt <- DT::datatable(
  mtcars,
  options = list(pageLength = 10),
  filter = 'top',
  rownames = FALSE
)

content <- create_content() %>%
  add_DT(my_dt)
  
# Option 2: Pass a data frame with options
content <- create_content() %>%
  add_DT(mtcars, options = list(pageLength = 5, scrollX = TRUE))
} # }