Hi, I have a treetable that uses scheme > $group > row to group my data into sections with a group row that spans all the columns, similar to this snippet Code Snippet. I’m trying to figure out a way to conditionally apply a CSS styling (specifically change the background color) to that group row based on the number of children in the group (in my use case if there are less than three children, make the group row red). Everything I’ve tried ends up applying the style to the cells hiding underneath the group row that spans the width of the table as opposed to the visible group row itself. Is there a way to accomplish this? Thanks!
Hi @cpolanish ,
There’s a partial solution that’ll work in Chromium browsers, but unfortunately, it is not supported by default in FF: Code Snippet
This snippet uses a pseudo-class :has
to check the className provided inside the row’s template
.
So far there’s no explicit way to apply conditional styling for a grouping header.
However, you can provide any styling for the content of the template
(font color, etc.).
As for the count of items in a group, you can create an additional field in grouping functors (map
, line 19 in the snippet) to calculate any custom values - they will appear as data fields in group items.