background color of the groupHeader

Viewed 17

Is there a way to dynamically change the background color of a groupHeader?

Background I have a table with open/closed windows grouped by floor. If a window of a group is open, the background color of the groupHeader should be red, otherwise green.

With the rowFormatter I manage to dynamically change the background color of a data row, but not the color of the groupHeader.

1 Answers

Unfortunately I am not a html/web programmer so I am not sure if the solution I made up is ok or has negative side effects.

I use the renderComplete callback:

"tabulator":{
     ...,
     "renderComplete": "function() {
         const gl = document.querySelectorAll(\".tabulator-row.tabulator-group\");
         gl.forEach((x) => { x.style.backgroundColor  = \"blue\" ;});
         console.log(gl);
         }",
...,
}

Works as desired, but is always called when the table is re-rendered and not only when the data content changes.

Related