How to hide specific cell content in grid?

I’m loading 2 columns into the grid where forEachRow the 1st hidden boolean value tells whether a checkbox should be displayed in the 2nd or not. If value is “0” in the 1st column then empty cell should be displayed in the 2nd.

myGrid.forEachRow(function(id){
    if (myGrid.cellById(id,3).getValue() == "0") {
        // hide content of myGrid.cellById(id,4)
    }
});

How to do that?

It is not available to hide a specific cell.
You may only hide the row:
docs.dhtmlx.com/api__dhtmlxgrid … idden.html
or the column of your grid:
docs.dhtmlx.com/api__dhtmlxgrid … idden.html

I don’t want to hide the cell itself but its content. I just want to have an empty cell there…

Could you please clarify the configuration of your grid. At least the using column types.

there are 4 rows in the grid, and I would like to hide the checkboxes in the 1st and 4th rows (because hidden column has values “0” there)

<rows>
    <head>
        <column hidden="false" type="ro" width="50">Nr.</column>
        <column hidden="true"  type="ro" width="50" />
        <column hidden="false" type="ch" width="50">Chbx</column>
    </head>
    <row>
        <cell>1</cell>
        <cell>0</cell>
        <cell>1</cell>
    </row>
    <row>
        <cell>2</cell>
        <cell>1</cell>
        <cell>0</cell>
    </row>
    <row>
        <cell>3</cell>
        <cell>1</cell>
        <cell>1</cell>
    </row>
    <row>
        <cell>4</cell>
        <cell>0</cell>
        <cell>0</cell>
    </row>
</rows>

You may use the following solution to “hide” the value of a cell:
myGrid.setCellExcellType(row_id, col_ind,“ro”);
myGrid.cellByIndex(row_id,col_ind).setValue("");

thx :slight_smile: