You can implement your requirements in different ways. For example, inside of beforeShowForm
event you can hide or show the
jQuery("#list").jqGrid({
colModel: [
{ name: 'Name', width: 200, editable: true },
//...
}).jqGrid('navGrid','#pager', { edit: true, add: true, del: false},
{ // edit option
beforeShowForm: function(form) { $('#tr_Name', form).hide(); }
},
{ // add option
beforeShowForm: function(form) { $('#tr_Name', form).show(); }
});
where the id “tr_Name” is constructed from “tr_” prefix and “Name” – the name property of the column from the colModel
.
UPDATED: In the answer and in another one are shown one more way how the properties can be changed dynamically immediately before the editing will be initialized.
UPDATED 2: Free jqGrid allows to define editable
as callback function or as "disabled"
, "hidden"
or "readonly"
. See the wiki article. It allows to implement the same requirements more easy.