Faced a simple task. But I can’t find a solution.
There is a regular list with 6 columns. But the list has been grouped according to one of the fields. (it is assumed that the list will be updated and you need to structure it somehow).
There is code that works on this list without grouping the elements.
OnPostRender: function(ctx) {
var statusColors = {
'W' : '#fc6a6a',
'R' : '#FFD800',
'Y' : '#01DF3A'
};
var rows = ctx.ListData.Row;
for (var i=0;i<rows.length;i++)
{
var status = rows[i]["flag"];
var rowId = GenerateIIDForListItem(ctx, rows[i]);
var row = document.getElementById(rowId);
row.style.backgroundColor = statusColors[status];
}
},
But it does not work when you enable grouping.
as I vizhk to the moment of expansion of group, the data is not loaded yet. Which direction to look ?? I tried to use the CSR, but then an error immediately appears. I can’t do anything with her.
I tried solutions where they change the color of the lines. But it does not work in my case