Change background color in a call in the datagrid

I am trying to find out if if is possible to change the background color of a cell in the datagrid depending on the contents.

I could not see a way to do it, so I added a default datagrid and asked AI. The resulting comment was this

"I'll update the datagrid to highlight rows with prices over $200 with a red background color by adding a getRowStyle callback function."

It did not work and I have been trying to find out what the getRowStyle callback function is, but can’t see it anywhere in the datagrid settings.

So, my questions are -

  1. Can a cell background color be change dynamically?

  2. What is hetROwStyle Callback and where can it be found.

Thanks

Hi Steve :waving_hand:,

You can dynamically change the color of a row if you create a custom column.

When you create a custom column you can add whatever you need inside, in my case I added a simple text element.

Now you can play with that dynamically, I binded the text’s background color to a formula that checks i the quantity is bigger than 40, then change its color.

Let me know if this helped.

Thanks.

1 Like