我有一個網頁與傳呼。我需要停止尋呼機加載另一個頁面,而在當前頁面上一行是在內聯編輯。所以當我創建網格時,我定義了onPaging函數jqGrid onPaging停止加載新的頁面,如果一行正在編輯
....
onPaging : function(){
if (inEdit()>0){
alert("Finish editing the current line");
return 'stop';
}
}
....
函數inEdit只是計算有多少行可以編輯attr。
這是做的工作,但是後來當我在調用停止分頁時在編輯的行上調用restoreRow函數時,函數無法將行恢復到以前的狀態。
後來編輯:
出現該問題後,當這個函數被調用取消編輯
function cancelEdit(id){
/*this line does nothing at all --> */ $('#list').jqGrid('restoreRow',id);
//The only way restore worked is by calling a grid reload but that is not really a solution
$('#list').trigger("reloadGrid", [{page:$('#list')[0].p.page}]);
$('#'+id+' [name=editButton]').show();
$('#'+id+' [name=submitButton]').hide();
$('#'+id+' [name=cancelButton]').hide();
}
PS:編輯/保存/取消/刪除的自定義按鈕
您是否正在從服務器向您的網格提供數據?在其他人正在編輯正在網格中顯示的數據的用例上? – Mark 2013-03-08 14:36:18
現在,數據在本地加載,問題不在於其他人編輯數據,但在網格中,您必須一次只能編輯1行,並且只能通過保存或取消來停止編輯(確認)網格的所有其他功能,可能會中斷編輯,例如分頁必須停止,直到編輯完成。 – 2013-03-08 15:40:07