Reload does not work

前端 未结 1 1194
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-22 09:05

In my jqGrid I use the multiselect parameter so that there is a checkbox on each row. The grid shows a list where each row has an \"Open\" status. A number of rows may be ch

相关标签:
1条回答
  • 2020-12-22 09:21

    It seems to me that the reason of your problem is in the usage of setGridParam. The method should be worked only if you change parameters, which are not arrays. Your current code merges old data with new one (see the main line of code of setGridParam, which calls deep version of $.extend). In case of arrays you should use the second (overwrite) parameter of setGridParam:

    var reloadGridWithUpdatedData = function (data) {
        var grid = $("#grid");
        grid.jqGrid("setGridParam", { data: data }, true);
        grid.trigger("reloadGrid");
    }
    

    or just don't use setGridParam at all. The method getGridParam gives the reference to internal object, which holds all parameters. It allows to replace (overwrite) any parameter in very simple way:

    var reloadGridWithUpdatedData = function (data) {
        var grid = $("#grid"),
            p = grid.jqGrid("getGridParam"); // get reference to all parameters
        p.data = data; // replace data parameter
        grid.trigger("reloadGrid");
    }
    
    0 讨论(0)
提交回复
热议问题