Because you use the example from my old answers (this and this) I feel that I should answer also on your question.
In the old example all fields, which can be modified during Add or Edit dialogs, has property editable:true
. The fields which should be shown only in the Add dialog will be made hidden inside of beforeShowForm event handle. In the same way we can temporary switch some fields to editable:false
before call of the editRow method and reset back to the editable:true
immediately after the call:
onSelectRow: function(id) {
if (id && id !== lastSel) {
grid.jqGrid('restoreRow',lastSel);
var cm = grid.jqGrid('getColProp','Name');
cm.editable = false;
grid.jqGrid('editRow', id, true, null, null, 'clientArray');
cm.editable = true;
lastSel = id;
}
}
You can see this live here.
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.