I'm looking for a way to disable editing of jqGrid rows where isPosted column has value true.
Both form and inline editing with actions formatter or double clicking in row are used. All kinds of editing needs to be disabled. I tried code below in jqGrid loadcomplete.
This does not disable form editing. Also double click in posted row shows save and cancel buttons (all columns are in readonly mode).
How to disable all kind of row editing for posted rows ? jqGrid is populated from remote jqson data.
loadCompete: function () {
var
postedCol = getColumnIndexByName($grid, 'isPosted'),
cRows = $grid[0].rows.length,
iRow,
row,
className,
isPosted,
cm = $grid.jqGrid('getGridParam', 'colModel'),
l,
iActionsCol = getColumnIndexByName($grid, '_actions');
l = cm.length;
for (iRow = 0; iRow < cRows; iRow = iRow + 1) {
row = $grid[0].rows[iRow];
className = row.className;
isPosted = false;
if ($.inArray('jqgrow', className.split(' ')) > 0) {
isPosted = $(row.cells[postedCol]).find(">div>input:checked").length > 0;
if (isPosted) {
if ($.inArray('jqgrid-postedrow', className.split(' ')) === -1) {
// todo: how to disable row editing and inline edit actions buttons.
// why those two lines do not disable
row.className = className + ' jqgrid-postedrow not-editable-row';
$(row.cells[iActionsCol]).attr('editable', '0');
$(row.cells[iActionsCol]).find(">div>div.ui-inline-del").hide();
$(row.cells[iActionsCol]).find(">div>div.ui-inline-edit").hide();
}
}
}
}
css file:
.jqgrid-postedrow
{
background-color: #FFFFD0;
background-image: none;
}