且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用inlineNav在jQgrid内联编辑中添加新行后重新加载网格

更新时间:2023-12-05 12:33:16

首先successfunc的值应该是函数而不是字符串(请参见当前代码"successfunc":"...")

First of all the value of successfunc should be the function and not the string (see in your current code "successfunc":"...")

我建议您尝试将相同的设置添加到addParams.addRowParamsinlineNaveditParams选项中.此外,我建议您将$(this).trigger("reloadGrid")successfunc放入setTimeout的内部,以确保在标准的行保存处理后 开始重新加载.

I would recommend you to try to add the same settings to both addParams.addRowParams and to editParams options of inlineNav. Moreover I would recommend you to place $(this).trigger("reloadGrid") from successfunc inside of setTimeout to be sure that reloading will be started after the standard processing of saving of the row.

所以代码可能与以下内容有关:

So the code could be about the following:

var editOptions = {
        keys: true,
        successfunc: function () {
            var $self = $(this);
            setTimeout(function () {
                $self.trigger("reloadGrid");
            }, 50);
        }
    };

$("#mygrid").jqGrid("inlineNav", "#mygrid_pager1", {
    addParams: {
        position: "last",
        addRowParams: editOptions
    },
    editParams: editOptions
});