2013-01-10 91 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