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.
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.
I had a similar requirement, just expanding on what Oleg already mentioned in his answer:
//get colModel properties
var cm = jQuery("#grid").jqGrid('getColProp','myColumn');
//some condition to enable or disable editing
cm.editable = false;
//always call editRow after changing editable property
jQuery('#grid').jqGrid('editRow', rowId, {});
//set default editable option
cm.editable = true;
Cheers :)