[Data Grid Reactive] Set Row background depending on cell value
Forge component by OutSystems R&D
Application Type
Reactive

It is a bit more complicated than the title says. 

I have a list of entities for shopping, where each order can have multiple Articles. By default the background for each row is white for even rows and light grey for odd, but I want it to change background color depending on the order. I will attach an example of this:

Something like the picture above, in a way that all the order with the same id are of the same color, and the colors alternate.

Is there any way to do this for the datagrid component?

Hi Takeru,

Thank you for query. Could you please refer this link Change row color.

Regards,

Shubham

mvp_badge
MVP

Hi @Shubham Janbandhu,

The question is about the DataGrid component, not the Table Record widget...

Next time, please read more carefully the question.

Cheers,
RG

Thank you, Ruben.

Definitely will try on it and come up with good solution.

Cheers,

Shubham

Hey Takeru,

As of now, our grid doesn't have this built-in, but we do have a workaround for you.
To achieve this you could something like this. On your grid initialize event, add a similar JS snippet

In my case, I added red or blue according to Sample_Product.Id, so you would have to change this according to your dataItem and desire.


I've attached an OML that contains this solution.

In case you have any doubts feel free to reach out,

Best regards,
Gabriel Lundgren

SetRowBackground.oml

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.