我試圖重新加載網格保存一行之後才能夠獲得該行的ID爲記錄的目的,但不知何故「aftersavefunc」和「successfunc」在保存之前觸發reloadGrid('#gridGrid')'。看起來'aftersavefunc'和'successfunc'是相同的。現在我無法添加或編輯任何行。jqGrid的火患「aftersavefunc」和「successfunc」前「saveRow」
var lastSel;
function onTelephoneSelect(id, status, e) {
if ($(e.target).hasClass('edit')) {
var editParameters = getEditParameters();
if (id && id !== lastSel) {
jQuery('#telephoneGrid').saveRow(lastSel);
}
jQuery("#telephoneGrid").jqGrid('editRow', id, editParameters);
lastSel = id;
}
}
function getEditParameters() {
return {
"keys": true,
"oneditfunc": null,
"successfunc": null,
"url": '@Url.Action("SaveTelephoneEntry","TelephoneEntry")?customerId=' + $('#SelectCompany').val(),
"extraparam": {},
"aftersavefunc": reloadGrid('#telephoneGrid'),
"errorfunc": null,
"afterrestorefunc": null,
"restoreAfterError": true,
"mtype": "POST"
}
}
我現在很絕望,找不到任何工作解決方案。
可能有人請點擊這裏幫助我或者已經面臨着同樣的問題,並想出一個可行的解決方案?
非常感謝提前。
首先,請務必包括有關的jqGrid的**版本**您使用的信息,並** *叉*([自由的jqGrid](https://github.com/free-jqgrid/jqGrid),商業[Guriddo的jqGrid JS](http://guriddo.net/?page_id=103334)或舊的jqGrid在版本<= 4.7)。秒,'aftersavefunc'的使用是正確的,但我想你可能在執行'reloadGrid'函數時遇到問題。你在裏面使用'setTimeout'嗎?現在什麼工作不正確?重新加載後你看到*舊數據*嗎?哪個'datatype'有網格?你使用'loadonce:true'選項嗎? – Oleg
謝謝你的回覆,奧列格。我會記住發佈我將來使用的版本和分支。 傑伊的海報下面有適合我的正確答案。所有東西('aftersavefunc','successfunc')都應該如此。 – Heimi