Custom method to style cells

Just added a custom method to change the color of the background of my table cells depending of the content, but doesn´t seem to work

def style_transform(self, value):

    if value == 0:
        return {'backgroundColor': 'red', 'color': 'white'}
    elif value == 1:
        return {'backgroundColor': 'green', 'color': 'white'}
    else:
        return {}

return style_transform(value)

Hello I think you can create styles and try something like :

 if value == 0:
        return {"classes": "table/Row1_1"} #red style
    elif value == 1:
        return {"classes": "table/Row1_2"} #blue style
    else:
        return "#000000" #defaut style
1 Like

Thanks Sebastiao