DHTMLX Docs & Samples Explorer

Index
dhtmlxgrid
API Methods

### enableAlterCss(cssE, cssU, perLevel, levelUnique)

Required library edition:
Required library file: dhtmlxgrid.js

set even/odd css styles

- cssE - name of css class for even rows
- cssU - name of css class for odd rows
- perLevel - true/false - mark rows not by order, but by level in treegrid (optional, default value: true - treeGrid, false - Grid)
- levelUnique - true/false - creates additional unique css class based on row level (optional, false by default)

Note that method should be called after setSkin(skin_Name) method.

    <style>
    .even{
       background-color:#22FF44;
       }
    .uneven{
       background-color:#41964e;
       }
    </style>
    <script>
       //minimal parameters set:
       mygrid.enableAlterCss("even","uneven");
       //disable even/odd rows in the grid:
       mygrid.enableAlterCss("","");
       //color rows in treeGrid by order:
       treeGrid.enableAlterCss("even","uneven",false,false);
       //color rows in treeGrid by level,every row level will have unique class (even_0 - 1st level, uneven_1 - 2nd level, even_2 - 3rd level, etc.)
       treeGrid.enableAlterCss("even","uneven",true,true);
    </script>

See also: setSkin, setStyle, enableRowsHover