datagrid {toastui} | R Documentation |
Interactive tables with tui-grid
Description
Create interactive tables : sortable, filterable, editable with the JavaScript library tui-grid.
Usage
datagrid(
data = list(),
...,
sortable = TRUE,
pagination = NULL,
filters = FALSE,
colnames = NULL,
colwidths = "fit",
align = "auto",
theme = c("clean", "striped", "default"),
draggable = FALSE,
data_as_input = FALSE,
contextmenu = FALSE,
datepicker_locale = NULL,
guess_colwidths_opts = guess_colwidths_options(),
width = NULL,
height = NULL,
elementId = NULL
)
Arguments
data |
A |
... |
Arguments passed to the |
sortable |
Logical, allow to sort columns. |
pagination |
Number of rows per page to display, default to |
filters |
Logical, allow to filter columns. |
colnames |
Alternative colnames to be displayed in the header. |
colwidths |
Width for the columns, can be |
align |
Alignment for columns content: |
theme |
Predefined theme to be used. |
draggable |
Whether to enable to drag the row for changing the order of rows. |
data_as_input |
Should the |
contextmenu |
Display or not a context menu when using right click in the grid. Can also be a list of custom options, see tui-grid documentation for examples. |
datepicker_locale |
Custome locale texts for datepicker editor, see example in |
guess_colwidths_opts |
Options when |
width , height |
Width and height of the table in a CSS unit or a numeric. |
elementId |
Use an explicit element ID for the widget. |
Value
A datagrid
htmlwidget.
See Also
datagridOutput()
/ renderDatagrid()
for usage in Shiny applications.
Examples
library(toastui)
# default usage
datagrid(rolling_stones_50)
# Column's width alternatives (default is "fit")
datagrid(rolling_stones_50, colwidths = "guess")
datagrid(rolling_stones_50, colwidths = "auto")
datagrid(rolling_stones_50, colwidths = NULL)
# disable sorting
datagrid(rolling_stones_50, sortable = FALSE)
# enable default filtering
datagrid(rolling_stones_50, filters = TRUE)
# enable pagination (10 rows per page)
datagrid(rolling_stones_50, pagination = 10)
# Themes
datagrid(rolling_stones_50, theme = "striped")
datagrid(rolling_stones_50, theme = "default")
# Empty table
datagrid(list())
# Empty columns
datagrid(data.frame(
variable_1 = character(0),
variable_2 = character(0)
))
# Specify colnames
datagrid(
data = data.frame(
variable_1 = sample(1:50, 12),
variable_2 = month.name
),
colnames = c("Number", "Month of the year")
)