I have grid with several editable cols
colModel: [
{
name: 'id',
width: 1,
hidden: true,
key: true,
resizable: false
},
{
name: 'name',
editable: true,
sortable: false,
resizable: false
},
{
name: 'name2',
editable: true,
sortable: false,
resizable: false
},
treeGrid: true,
treeGridModel: 'adjacency',
ExpandColumn: 'name',
For some reason I'm needed to have some not editable cells in these cols
loadComplete: function() {
var ids = grid.jqGrid('getDataIDs');
for (var i=0;i<ids.length;i++) {
var id=ids[i];
var row_data = $(this).jqGrid('getRowData', id);
if (row_data.zzz > 0) {
if (row_data.zzz > 1)
grid.jqGrid('setCell',id,'name2','','not-editable-cell');
else
...
}
else {
grid.jqGrid('setCell',id,'name','','not-editable-cell');
...
}
}
}
So some rows have both cells editable(name, name2), some only one (name or name2)
I don't have any problems If I use editCell But editRow doesn't pay attention on not-editable-cell class
I've solved this problem by editing of jquery.jqGrid.src.js I understend that it's very bad way
$.jgrid.extend({
//Editing
editRow : function(rowid,keys,oneditfunc,successfunc, url, extraparam, aftersavefunc,errorfunc, afterrestorefunc) {
.......
return this.each(function(){
var $t = this, nm, tmp, editable, cnt=0, focus=null, svr={}, ind,cm;
if (!$t.grid ) { return; }
ind = $($t).jqGrid("getInd",rowid,true);
if( ind === false ) {return;}
editable = $(ind).attr("editable") || "0";
if (editable == "0" && !$(ind).hasClass("not-editable-row")) {
cm = $t.p.colModel;
$('td[role="gridcell"]',ind).each( function(i) {
///
if (!$(this).hasClass("not-editable-cell")) {
///
nm = cm[i].name;
var treeg = ($t.p.treeGrid===true && nm == $t.p.ExpandColumn) ? true : false;
Is it possible to solve this problem via formatter?