0

I am using table & column components from react-virtualised module.

I have a requirement to add color to cell text based on few conditions. I did not find a way to do so.

This is the Link for code reference

Please help me for solution

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
user8599269
  • 241
  • 1
  • 11

1 Answers1

0

Found a solution using cell renderer

getColorPalate(risk) {
    let riskColor;
    switch (true) {
        case risk < 25:
            riskColor = '#00CD63';
            break;
        case risk > 25 && risk < 50:
            riskColor = '#F8E71C';
            break;
        case risk > 50 && risk < 75:
            riskColor = '#F09502';
            break;
        default:
            riskColor = '#F24343';
            break;
    }
    return ( < div style = {
                {
                    color: riskColor,
                }
            } > {
                risk
            } < /div> ); }
user8599269
  • 241
  • 1
  • 11