On an Interactive Grid, I’m trying to add a background-color to a row when the value of a hidden column is equals to ‘Y’.
I tried multiple solutions but none of them is working.
- I set a static ID to my IG : igConcessions
- I set a static ID to my hidden column (NIVELLEMENT_CONCE) : conceNivelle
- I created a Dynamic Action on Page Load which execute JavaScript Code
$(document).ready(function() {
//I also tried to set the column name instead of the column ID
$("#igConcessions td[headers='conceNivelle']").each(function() {
if ($(this).text().trim() === "Y") {
$(this).closest("tr").css({'background-color': 'red'});
}
});
});
I also tried another code
// Sélectionnez toutes les lignes de la grille interactive
var rows = document.querySelectorAll("#igConcessions .a-GV-row");
rows.forEach(function(row) {
// Trouver la colonne cachée avec la valeur 'Y' ou 'N'
var hiddenColumn = row.querySelector("td[headers='conceNivelle']");
if (hiddenColumn && hiddenColumn.textContent.trim() === 'Y') {
// Ajouter la classe CSS pour colorier la ligne en rouge
row.classList.add("highlight-red");
}
});
None of these worked, how can I do it differently ?
Thanks in advance