colDef | R Documentation |
Use colDef()
to customize the columns in a table.
colDef(
name = NULL,
aggregate = NULL,
sortable = NULL,
resizable = NULL,
filterable = NULL,
searchable = NULL,
filterMethod = NULL,
show = TRUE,
defaultSortOrder = NULL,
sortNALast = FALSE,
format = NULL,
cell = NULL,
grouped = NULL,
aggregated = NULL,
header = NULL,
footer = NULL,
details = NULL,
filterInput = NULL,
html = FALSE,
na = "",
rowHeader = FALSE,
minWidth = 100,
maxWidth = NULL,
width = NULL,
align = NULL,
vAlign = NULL,
headerVAlign = NULL,
sticky = NULL,
class = NULL,
style = NULL,
headerClass = NULL,
headerStyle = NULL,
footerClass = NULL,
footerStyle = NULL
)
name |
Column header name. |
aggregate |
Aggregate function to use when rows are grouped. The name
of a built-in aggregate function or a custom To enable row grouping, use the |
sortable |
Enable sorting? Overrides the table option. |
resizable |
Enable column resizing? Overrides the table option. |
filterable |
Enable column filtering? Overrides the table option. |
searchable |
Enable or disable global table searching for this column.
By default, global searching applies to all visible columns. Set this to
|
filterMethod |
Custom filter method to use for column filtering.
A |
show |
Show the column? If |
defaultSortOrder |
Default sort order. Either |
sortNALast |
Always sort missing values (NA or NaN) last? |
format |
Column formatting options. A |
cell |
Custom cell renderer. An R function that takes the cell value,
row index, and column name as arguments, or a |
grouped |
Custom grouped cell renderer. A |
aggregated |
Custom aggregated cell renderer. A |
header |
Custom header renderer. An R function that takes the header value
and column name as arguments, or a |
footer |
Footer content or render function. Render functions can be an
R function that takes the column values and column name as arguments, or a
|
details |
Additional content to display when expanding a row. An R function
that takes the row index and column name as arguments, or a |
filterInput |
Custom filter input or render function. Render functions can
be an R function that takes the column values and column name as arguments,
or a |
html |
Render content as HTML? Raw HTML strings are escaped by default. |
na |
String to display for missing values (i.e. NA or NaN). By default, missing values are displayed as blank cells. |
rowHeader |
Mark up cells in this column as row headers? Set this to Cells in the row names column are automatically marked up as row headers. |
minWidth |
Minimum width of the column in pixels. Defaults to 100. |
maxWidth |
Maximum width of the column in pixels. |
width |
Fixed width of the column in pixels. Overrides |
align |
Horizontal alignment of content in the column. One of
|
vAlign |
Vertical alignment of content in data cells. One of |
headerVAlign |
Vertical alignment of content in header cells. One of
|
sticky |
Make the column sticky when scrolling horizontally? Either
If a sticky column is in a column group, all columns in the group will automatically be made sticky, including the column group header. |
class |
Additional CSS classes to apply to cells. Can also be an R function
that takes the cell value, row index, and column name as arguments, or a Note that R functions cannot apply classes to aggregated cells. |
style |
Inline styles to apply to cells. A named list or character string.
Can also be an R function that takes the cell value and row index as arguments,
or a Note that R functions cannot apply styles to aggregated cells.
If |
headerClass |
Additional CSS classes to apply to the header. |
headerStyle |
Inline styles to apply to the header. A named list or character string. Note that if |
footerClass |
Additional CSS classes to apply to the footer. |
footerStyle |
Inline styles to apply to the footer. A named list or character string. Note that if |
A column definition object that can be used to customize columns
in reactable()
.
reactable(
iris,
columns = list(
Sepal.Length = colDef(name = "Sepal Length"),
Sepal.Width = colDef(filterable = TRUE),
Petal.Length = colDef(show = FALSE),
Petal.Width = colDef(defaultSortOrder = "desc")
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.