Reload grid after add a new row in jQgrid Inline edit using inlineNav

后端 未结 3 814
难免孤独
难免孤独 2021-01-29 01:34

I have been using inlineNav method for inline add as follows.

jQuery(\"#mygrid\").jqGrid(\"inlineNav\", \"#mygrid_pager1\",{\"addParams\":{\"position\":\"last\"         


        
相关标签:
3条回答
  • 2021-01-29 01:47

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

    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
    });
    
    0 讨论(0)
  • 2021-01-29 02:06
    $("#list").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid');
    
    0 讨论(0)
  • 2021-01-29 02:07

    I think the easiest way is after you finish add something, call reload function separately like jQuery("#myGrid").reload();

    0 讨论(0)
提交回复
热议问题