You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With the latest update to v0.3.0, using the groupBy argument with a custom cell color function creates incorrect colors for the grouped headers. It looks like the color from the previous row is used.
library(reactable)
library(dplyr)
# color function for reactable cells
colfun <- function(x){
case_when(
x == 'a' ~ 'red',
x == 'b' ~ 'yellow',
x == 'c' ~ 'green'
)
}
totab <- tibble(
var1 = c('a','a','b','b', 'c', 'c')
)
reactable(totab,
columns = list(
var1 = colDef(
style = function(x){
list(background = colfun(x))
})),
groupBy = 'var1'
)
With the previous version 0.2.3, the grouped headers had no color.
Thanks for the bug report, it should be fixed in the v0.3.0.9000 development version (a396ccb) now:
R style functions no longer apply to aggregated cells and rows incorrectly
(@fawda123, #250).
JavaScript render functions and style functions no longer receive an invalid cellInfo.index or rowInfo.index property for aggregated cells and rows
(#250).
The problem was that aggregated rows were being given their own row indices like 0 and 1, which doesn't make sense because they're not actual rows in the data. This was an oversight with the react-table v7 migration, and unfortunately doesn't have a good workaround besides staying on 0.2.3 or installing the development version.
With the latest update to v0.3.0, using the
groupBy
argument with a custom cell color function creates incorrect colors for the grouped headers. It looks like the color from the previous row is used.With the previous version 0.2.3, the grouped headers had no color.
The text was updated successfully, but these errors were encountered: