How to access DataGrid attributes inside DataGrid column for dynamic styling?

I have a DataGrid linked with an entity that has 3 attributes, for example - income, expense, and remainder.   I need to apply dynamic styles to the third column so that if the difference between income and expense is a positive number, the remainder will be green, and if the number is negative, it will be red.   But I can't apply a normal expression because as I can see I can't access any attribute of the DataGrid Entity inside the DataGrid Column.   What would you recommend? Is there a way to implement dynamic styles in this example without replacing the DateGrid widget with a different one?
3 answers

Hi Maxim Velichkin,

I found solution has been provided by Tim v Steenbergen for the same question-

He suggested to use the GridCellStyler widget from appstore to styling cells or rows of data grid.

I haven’t tried it yet, but seems to be interesting and surely excited to try it out.

Hope this helps you.

Thank you.


Hi Maxim,


the solution Rahul is suggesting is probably the solution you’re looking for.


In addition to his answer, I added some printscreens of the functionality. 


Editing the rule:


In my case a nanoflow gives the boolean to apply styling or not. 


HI Maxim,

for the datagrid columns you can directly write the dynamic classes based on your conditions you wish don't add the default class to the column create two classes green and red where based on if else condition in the dynamic classes.

if the above solution not works

use the above link for probable solution.