How I can change the color of row in data grid 1 and 2 based on Enumeration values?

0
Enum values like 'Active' or 'Inactive' (P.s dynamic classes didn't worked)
asked
2 answers
0

Hi Mykyta,

 

As stated in your other question, for DataGrid 1 I would use this module.

 

For DataGrid 2 however, you could apply the following steps:

 

When opening your DataGrid2, add a 'Dynamic row class'. The expression should look something like this:

 

if $currentObject/{YourEnumAttribute} = {YourEnumValue} then '{YourClass}' else empty

 

You can obviously expand this logic as you wish.

 

Next, add the following lines to whichever Stylesheet you are using in your application:

.{YourClass}{
    .td {
        background-color: red;
    }
}

This code will make the row that matches the ENUM value color red. You can obviously change the color as you seem fit.

 

All the values between '{ }' should be changed with your own values.

 

Good luck!

answered
1

Dynamics classes can work in Datagrid 2:

Add a dynamic cell class (to each column)

image.png

 

If you have some styling like

image.png

 

and add the class "grid-color" to your datagrid2, the result will be:

image.png

 

answered