Should one replace the usage addJSONData of jqGrid to the usage of setGridParam(), and trigger('reloadGrid')?

前端 未结 6 1293
醉酒成梦
醉酒成梦 2020-11-28 09:54

I wrote recently an answer to the question \"jqGrid display default “loading” message when updating a table / on custom update\". While writing the answer I thought: why doe

6条回答
  •  庸人自扰
    2020-11-28 10:30

    I use the addJSONData method for paging purpose as explained below.

    On the page load, the jqgrid is loaded with the JSON data returned by URL. We need the next page functionality to work, but without having to switching the pages. i.e Initially, Page 1 is loaded with say 10 records. When I click on Next button (NavButton), instead of loading next 10 records on next page, I want all 20 records to be displayed on the Page 1 itself.

    Here, on the second and subsequent requests, I am using addJSONData method. I make ajax call on click of Next button and then use addJSONData to append the json data to the existing 10 records. I cannot use the setGridParam because when I use that, the initial 10 records are gone and it just loads the next 10 records on the same page.

    If you have any alternative for addJSONData for this particular functionality, I will be happy to know. As I am facing issues with Subgrid expansion, Filter toolbar etc when the next set of records is loaded using addJSONData.

提交回复
热议问题