I spend an hour or two to figure out I forgot to return true in an empty beforeSelectRow event I had added, and this made the grid didn't allow cell editing...
Hope it may saves you a bit of times.
BTW, if you're looking for how to change the column editable in run time, here is an example:
var grid1 = $('#grid1');
grid1.jqGrid({
...
colNames:[
'name','note','new'
],
colModel:[
{name:'name',index:'name',editable=false},
{name:'note',index:'note',editable=true},
{name:'new',index:'new',editable=false}
],
cellEdit:true,
cellsubmit: 'clientArray',
...
beforeSelectRow : function(rowid) {
var data = grid1.jqGrid('getRowData', rowid);
var cm = grid1.jqGrid('getColProp','note');
cm.editable = (data.new=='Y') ? true:false; //'note' will be allowed to edit if 'new' is 'Y'
return true;
},
No comments:
Post a Comment