glin / reactable

Interactive data tables for R
https://glin.github.io/reactable
Other
612 stars 79 forks source link

Feature request : apply colDef to multiple (not all) columns at once #369

Open lbertela opened 2 months ago

lbertela commented 2 months ago

Hi, I'm trying to customize multiple columns at once (those columns should have the same customization) using colDef. Unfortunately, it seems that I can only custom one column at a time by specifying the column name. defaultColDef is no use for me as I would like to modify only some columns and not all columns.

Does it exist a way to apply colDef to multiple columns at once ?

If not, would this be a possible feature ? Or does anyone have a solution to this issue ?

Thanks in advance for the help.

glin commented 2 months ago

Columns are a list of reactable::colDef() objects, so it's possible to programmatically generate and reuse column definitions. I wrote up a short guide on reusing column definitions once, so this may help: https://github.com/glin/reactable/issues/197#issuecomment-932827117