glin/reactable

Conditional Formatting in the footerStyle

NicJstevens5089 opened this issue · 1 comments

Are there any plans to update the package so that the footerStyle can take in R or JS Function arguments to conditionally color the text in the footer? Right now it appears to only take a static formatting, but I am needing to color the footers conditionally. I have pasted a script of an example of what I am after, but as a short summary I have two columns that show the change between the two previous columns and the footer represents the overall change across the groups.

I was able to conditionally format the groups individual changes using the normal style format for the columns, but cannot extend the same formatting to the footer for the overall change as the footerStyle parameter will not accept my R function as an argument. In theory, the way I have it coded in my example styles the

footer the same way it does in the overall column styling. Do we know if there are plans to make it possible to style the footer the way I have it in the commented out portions of my example scripts?

(EDIT: Apologies, code formatting was a little funny here, please copy and paste code from word document into R to run example)

Reactable footerSyle Formatting example.docx

glin commented

I like this idea. Honestly I'm not sure why it doesn't take an R/JS function because the footer content argument does take a render function. There may have been a reason, but I don't remember why now. We should also allow footerClass to take a function. Thanks for the suggestion - tagging as a feature request.

edit: headerStyle/headerClass should also take functions to be consistent.