开发者

Update data in jqGrid

I use jqGrid in this scenario:

  1. 开发者_如何学GoThe grid gets JSON data from the first URL. If the URL returns correct JSON - the grid displays that data.

  2. If the URL returns incorrect data, then it fires the 'loadError' event of grid. In this event I want to change the URL of the grid to another URL and get the JSON data from the new URL.

Here is my code.

loadError: function(xhr, st, err) {
 $("#list").setGridParam({ url: '/new_url' });
        $("#list").trigger("reloadGrid");
}

But it doesnt't works. Why?


Even though this is a really old question if someone else stumbles upon this try calling GridUnload first. So, your code would change to:

loadError: function(xhr, st, err) {
    $("#list").jqGrid('GridUnload');
    $("#list").setGridParam({ url: '/new_url' });
         $("#list").trigger("reloadGrid");
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜