Change the background color of a row in an interactive report based on a column value
I have the following columns
ID (link) and GEKOPPELD and some other columns
The column GEKOPPELD contains a X or is null
- Add to the column ID (with a link option) –> link attributes. : id=”ID_#GEKOPPELD#”. For every row with an X in the column GEKOPPELD the id of the ID-column will be ID_X
- Add an dynamic action (on load) jquery: $(“#D_X”).parent().parent().children().css(“background-color”,”#bda7cb”);
The element with the #ID_X is an a-element, the first parent is a td-element and the second parent is the tr-element, the row we want.
Every row with an ‘X’ in de column GEKOPPELD will be colored purple.
Alternative javascript:
var x = document.getElementById(“ID_X”);
if (x) {
var row = document.getElementById(“ID_X”).parentElement.parentElement;
for (var j = 0; j < row.cells.length; j++) {
row.cells[j].style.setProperty(“background-color”, “#bda7cb”, “important”);
}
}