使用inlineNav刷新网格 [英] refresh grid using inlineNav

查看:86
本文介绍了使用inlineNav刷新网格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用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将同时在editsave上调用,因为这两个操作都支持此回调.

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刷新网格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆