Hi,
I am attempting to modify a script report to include conditional formatting of rows in a report.
Once a specific condition in a specific cell is met, I would like the text to appear into a certain color.
The problem is that I am not able to successfully modify the JS file associated with the report. It looks like the condition I specified is never met.
"formatter": function(value, row, column, dataContext, default_formatter) {
value = default_formatter(value, row, column, dataContext);
if (dataContext["Balance"] > 0){
value = "<span style='color:green!important;font-weight:bold'>" + value + "</span>";
} else {
value = "<span style='color:red!important;font-weight:bold'>" + value + "</span>";
}
return value
In this specific case, a column is called “Balance”. Once a value in a cell of this column is greater than zero, I want to format the text of all the cells in the row. This does not seem to work. Which kind of object is dataContext? Is it an array, a list or something like that? Do I need to parse it?