Generate column definitions with filter dropdown menus for specified columns in a Reactable table
colDef_filter_select.Rd
The colDef_filter_select
function generates column definitions with filter dropdown menus
for specified columns in a Reactable table. It creates column definitions based on provided column
names and a unique ID for the Reactable table.
Arguments
- cols
A character vector specifying the column names for which the filter dropdown menus column definitions are to be generated.
- id
A character string specifying the unique ID for the Reactable table. This ID should be specified both in the function call and in the Reactable table definition using the `elementId` parameter and setting `filterable = TRUE`.
Value
A list of column definitions suitable for use in a Reactable table with filter dropdown menus.
Examples
# Set the unique ID for the Reactable table
id <- "temp_id"
mtcars %>%
rownames_to_column("cars") %>%
reactable(
defaultColDef = colDef(footerStyle = list(fontWeight = "bold")),
columns = combined_named_lists(
colDef_filter_select(cols = c("cars"), id = id)
),
elementId = id, filterable = TRUE
)
#> Error in map(item_list, names): could not find function "map"