Reload does not work

十年热恋 提交于 2019-11-29 18:39:51

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");
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!