How to achieve background color of datagrid2 for even rows have one color and odd rows have another color?

0
Hi, How to achieve background color of datagrid2 for even rows have one color and odd rows have another color
asked
2 answers
0
.customclass {
    
    .table {
        background-color: transparent;

        .widget-datagrid-grid-body {
            .tr:nth-child(even) {
                .td {
                    background-color: white;
                }
            }
        }
    }
}

 

Hi krishnaveni ch,

 

This code above should work, just make sure that you put custom class on the datagrid2 itself, and when you do it, copy this code and just change this ".customclass" with your own.

 

This is for even rows, if you want odd rows, just put different background color to the whole table, or use part of the code that says .tr:nth-child(even), copy it and put odd instead of even and set other color

 

Regards,

Marko

 

 

answered
0

Hi krishnaveni ch,

 

there is also a built-in option for datagrid 2 by enabling the styling property 'striped':

 

image.png

 

To change the color of the alternate rows, you can edit the custom-variables file in the styling section:

image.png 

answered