а

DhtmlxGrid mark cell


#1

Hello Sir,

Could you give me a solution…

I would like to mark a cell if only a row index is
odd numbers.

I am trying to config mark column’s property .

for example
{
width: 160, id: “hours”, header: [{ text: “Number of hours” }, { content: “inputFilter” }],
mark: function (cell, data, row, col) {
WHAT TO DO ???
//Can i get row index in here ?
}
}

One more, Can i UNMARK a cell (dynamically) like i do in previous version ?

Thank you.


#2

Unfortunately it is not available to get the row index in the mark function.
As a workaround you may use the following solution to “mark” the odd cells of the specific column:

var grid = new dhx.Grid("grid", {
   css: "red", // class with the backkground color for all the grid
    rowCss: function () {
        return "red_row";  //add some custom row class
    },
//...
{
width: 160, id: “hours”, header: [{ text: “Number of hours” }, { content: “inputFilter” }],
mark: mark: () => "red_column" // and a custom column class
}

then in your css you check if the element is in your grid class, column class and in the odd row:

    .red .red_row:nth-child(odd) .red_column{
        background: red;
    }

yes, a little too complex, but it will work regardless to you dataset state.