问题描述
我正在使用inlineNav,如下所示:
I am using inlineNav as follows:
var inlineparams = {
addParams: {useFormatter:false},
editParams: {extraparam: {
"action": "ajaxgrid",
"subaction": "jqedit",
"tableid": "sysbuglist",
"sessionid":"fd7c74d8-d3cb-102f-bd56-0015171f0bcc"
}},
add:true,
edit:true,
save:true,
cancel:true,
aftersavefunc:reloadGrid};
$("#navgrid").jqGrid("inlineNav","#navgrid_bottompager", inlineparams);
因此,我正在使用bottompager上的添加,编辑,保存,取消按钮.
So, I am using the add, edit, save, cancel buttons on the bottompager.
问题:保存到服务器后如何获得控制权?保存到服务器运行良好,我只想保存后刷新网格.
Question: How do I get control after a save to the server? Saving to the server is working well, I just want to refresh the grid after a save.
推荐答案
来自用于内联编辑的源代码,您可以看到在选项或保存"按钮的回调中,对于inlineNav
没有明确的aftersavefunc
.
From the source code for inline editing, you can see that there is no explicit aftersavefunc
for inlineNav
, either in the options or in the save button's callback:
if(o.save) {
$($t).jqGrid('navButtonAdd', elem,{
...
onClickButton : function () {
var sr = $t.p.savedRow[0].id;
if(sr) {
...
if( $($t).jqGrid('saveRow', sr, o.editParams) ) {
$($t).jqGrid('showAddEditButtons');
}
}
}
但是,您可以将aftersavefunc
作为editParams
的一部分传递:
However, you can pass aftersavefunc
as part of editParams
:
var inlineparams = {
addParams: {useFormatter:false},
editParams: {extraparam: {
"action": "ajaxgrid",
"subaction": "jqedit",
"tableid": "sysbuglist",
"sessionid":"fd7c74d8-d3cb-102f-bd56-0015171f0bcc"},
aftersavefunc: reloadGrid},
...
应该这样做.请注意,由于aftersavefunc
将同时在edit
和save
上调用,因为这两个操作都支持此回调.
That should do it. Just be aware that aftersavefunc
will be invoked on edit
as well as save
, since both operations support this callback.
这篇关于使用inlineNav刷新网格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!