How could I make checkbox column (ch type) read-only?

You can define onEdit event and block edit operation for necessary column, it will work for all excells, including checkboxes

mygrid.attacEvent(“onEditCell”,function(stage,rid,cind){
    if (cind==CHECKBOX_COLUMN) return false;
});

Thanks a lot, it works!

I had the same problem to make some of the textbox in grid read only. Where should I put this code? In dhtmlXGrid.js or in my coding file? I try 2 method also didn’t work. And the ‘CHECKBOX_COLUMN’ was a constant value or it was the syntax? Please help~! Thanks!

mygrid.attacEvent(“onEditCell”,function(stage,rid,cind){
    if (cind==CHECKBOX_COLUMN) return false;
});

The code need to be placed in your file after grid initialization


And the ‘CHECKBOX_COLUMN’ was a constant value or it was the syntax

In sample above
    mygrid - name of your grid
    CHECKBOX_COLUMN - index of column for which you want to disable edit operation.

If you need to disable edit operations for some random element through grid you can use different techique

a) from XML

   

          Editable
   

          Not Editable
      

b) By JS api
    mygrid.cells(rowId,cellIndex).setDisabled(true);

Hi, i had try to use mygrid.cells(rowId,cellIndex).setDisabled(true); , this does not work.
I was using mygrid.setColTypes(“ed,coro”); in the grid. I had go through the function  this.setDisabled = function(fl){ in dhtmlXGridCell.js file, the first statement was ’ if(this.isCheckbox())’, so, I thing currently the mygrid.cells(rowId,cellIndex).setDisabled(true); only work for checkbox, right?