2013-01-10 99 views
0

我需要在jqgrid和保存數據後保存onclickonPgButtons上的數據它需要轉到下一個/上一行.Below函數寫入OnClickPgButton編輯窗體函數。如何停止從重新加載JqGrid

jQuery("#table").jqGrid('navGrid', '#pager', { search: false, refresh: false, del: false, add: false, cloneToTop: true }, { height: editFormheight, width: editFormwidth, reloadAfterSubmit: true, closeAfterEdit: true, recreateForm: true, cloneToTop: true, 
    onclickPgButtons: function (whichbutton, formid, rowid) { ModificationDataSave(whichbutton, formid, rowid); $("#edithdtable").stop(); } 
}); 
function ModificationDataSave(whichbutton, formid, rowid) { 

if ($("#" + $("#PId").val()).closest("td").text().trim() != $("#Name").val()) { 
    if (confirm('There is some unsaved data. Would you like to save?')) { 
     $("#sData").trigger("click"); 
    } 
    else { 
     $("#edithdtable").stop(); 
    } 
} 

}

我的問題是保存數據後,我需要顯示editform的下一個/上一行。

在此先感謝..

+0

你能指定你的問題嗎?你的html是什麼樣的,在哪裏調用的函數,...嘗試添加一個[jsfiddle](http://jsfiddle.net/) –

+0

將數據保存到數據庫後..然後我需要顯示編輯表單在我的頁面上.. @Hans Vn – Ksnrg

+0

也許你可以創建表單,但不要讓它顯示(使用css:display:none;)。顯示它,當你需要它$(「#form#)。show(); –

回答

0

如果我理解正確你的問題,你應該剛剛從回調onclickPgButtons返回false

onclickPgButtons: function (whichbutton, formid, rowid) { 
    if (...) { // do some tests 
     return false; 
    } 
} 

修訂:如果您需要沒有電網的重裝提交您需要的結果只需使用reloadAfterSubmit: false選項進行表格編輯(請參閱the documentation)。

+0

它不工作..網格重新加載和Editform不顯示在頁面上。 – Ksnrg

+0

@Ksnrg:我不確定我是否正確理解你需要什麼。看看我的答案中的「** UPDATED **」部分。 – Oleg

+0

我的過程如下:1)如果我在EditFormField中更改任何內容,然後單擊Next/Prev Button,然後我需要顯示彈出窗口(confirmmsave)它包含兩件事確定並取消2)如果我單擊確定然後EditForm更改數據通過使用$(「#sData」)。trigger(「click」);保存到數據庫(.ashx)中; 。然後我需要去EDITform中的next/prev,我需要顯示jqgrid中的更改 – Ksnrg