Skip to contents

Table module that displays data.frame like objects as a table that are supported by DT::renderDT() and DT::DTOutput().

Details

The Table module exposes reactive bindings from the datatable object from DT, in bindings field. These bindings are:

  • cell_clicked

  • cells_selected

  • cell_info

  • rows_current

  • rows_all

  • rows_selected

  • row_last_clicked

  • columns_selected

  • search

  • search_columns

  • state

These bindings allow you to trigger events with i.e. shiny::observeEvent() in another module.

For a full description of the exposed bindings, consult the DT documentation: https://rstudio.github.io/DT/shiny.html

Super class

DarwinShinyModules::ShinyModule -> Table

Active bindings

bindings

(reactiveValues) Reactive bindings for DT::datatable.

data

(data.frame) Reactive data, use shiny::isolate() to get the non-reactive data.

title

(character) Title of the table.

options

(list(n)) List of options used by DT::datatable.

filter

(character(1)) Filter option used by DT::datatable.

Methods

Inherited methods


Method new()

initialize

Usage

Table$new(
  data,
  title = "Table",
  options = list(scrollX = TRUE),
  filter = "top"
)

Arguments

data

(data.frame) Data to plot with, usually a data.frame-like object.

title

(character(1)) Title of the table. When set to NULL, no title is shown.

options

(list) table options, by default it shows additional items next to the table like search box, pagination, etc. Only display the table using list(dom = ”)

filter

(character: "top") filter option, it can be either "none", "bottom" or "top" (default)

Returns

self


Method validate()

validate

Usage

Table$validate()

Returns

self


Method clone()

The objects of this class are cloneable with this method.

Usage

Table$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

library(DarwinShinyModules)

table <- Table$new(data = mtcars)

if (interactive()) {
  preview(table)
}