isPosted 列の値がtrueのjqGrid行の編集を無効にする方法を探しています。
アクションフォーマッターまたは行のダブルクリックによるフォーム編集とインライン編集の両方が使用されます。あらゆる種類の編集を無効にする必要があります。jqGrid loadcomplete で以下のコードを試しました。
これは、フォームの編集を無効にしません。また、投稿された行をダブルクリックすると、保存ボタンとキャンセル ボタンが表示されます (すべての列が読み取り専用モードになります)。
投稿された行のすべての種類の行編集を無効にする方法は? jqGrid は、リモートの jqson データから取り込まれます。
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;
}