Aditya K Aditya K - 9 days ago 6
Javascript Question

How to disable editing for some cells in row editing of JQGrid?

When I click on any row of my Grid, All editable columns become editable.

I want some of the columns to be editable on each row separately.

Column 1, Column 2, Column 3
ROW Number 1 - editable, non-editable, non-editable
ROW Number 2 - non-editable, editable, non-editable
ROW Number 3 - editable, non-editable, non-editable


Thanks in Advance

Answer

If you use inline editing mode and want to decide dynamically which cells of the row will be editable for example based on the contain of the cells you can do this in the way which I described here. You can do this with another method also:

$(this).jqGrid('setColProp', 'YouColumnName', {editable:false});

So you should just set editable to false or true before calling of editRow method. In the way you can implement any logic which you want.

UPDATE: Free jqGrid allows to define editable as callback function. See the wiki article. It allows to make the column editable in some rows and holding non-editable for other rows.