There is a jqgrid with 10 records in it. Each record has a button that makes the current row editable. after the edit button is pressed, we populate the old edit field with a save and cancel edit button. After a save/cancel, the edit button is restored. This all works fine until you try and edit a record, then change attempt to change the page to the next 10 records.
var btnSave = "<input style= height:22px; type= button value= Save onclick="$( #list ).jqGrid( saveRow , " + rowId + " , null, <%= Url.Action("GridSave","Translation")%> , null, aftersavefunc);" />";
var btnCancel = "<input style= height:22px; type= button value= Cancel onclick="$( #list ).jqGrid( restoreRow , " + rowId + " , aftercancelfunc);" />";
$("#list").jqGrid( setRowData , rowId, { act: btnSave + btnCancel });
在你打上ed子后,如果你尝试并改变该页,就会提出确认的辩词,警告你你,你可能会失去变化。
This is within the paging code:
onPaging: function (pgButton) {
// pgButton: first, last, prev, next, records (# of records ddl), user (user types in new page num)
// if in edit mode:
var nextPg = $("#list").getGridParam("page");
var nextRecords = $("#list").getGridParam("rowNum");
if(inEditMode) {
var result = confirm("You might be abandoning unsaved changes. Are you sure you want to perform this action?");
if (!result) {
$("#list").setGridParam({ page: currPg, rowNum: currRecords }); //Workaround - jqGrid still increments the page num even when we return stop so we have to reset it (and track the current page num)
return stop ;
}
else {
$("#list").jqGrid( showCol , ["act"]);
}
}
},
如果你取消方言,你就在本页。
我们所看到的问题是,如果你篡夺记录、尝试和改变页数,取消页数的改动,并尝试和取消对记录的编辑,则复劳永不会使记录领域再次变得不正确。 它还将储蓄/集装箱纽扣吨改为ed。
奇怪的是,在采取相同步骤后节省开支会受到罚款。 它只是恢复问题。