I have a ThingsBoard table widget displaying Node Status as 0 or 1. Where 0 = OK, 1 = ALARM.
I have already created nodeStatus to return strings of 0 = OK, 1 = ALARM.
The following is my current code in the 'Advanced Data Key Tab - Use cell content function':
var nodeStatus = entity['sensor.a'];
if (nodeStatus == '0')
{
return "OK";
} else {
return "ALARM";
}
I want to change the Returned String colour to the following:
OK = Green font
ALARM = Red font
How do I do this?
UPDATE: I have added extra code to the Cell Style function: f(value) as suggested by @lupz below.
This is now making the entire column change to Red:
I have also tried enabling "Use data post-processing function" in the "Settings" Tab, with no change:
UPDATE:
I have removed the nodeStatus function from the "Cell Content Function" as per below comments:
After removal of the single quotes around the '0' next to if(value === 0), I have the same issue as above (the whole column is red).