Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
70
igGrid not showing pages while loading after external button click
posted

Hi,

I am having issues with remote pagination. The pages are not getting displayed properly on click of a button outside of the grid.

Suppose I am having 20 records in total, hence count attribute will be 20, while my server serves first 4 records. On the first time load, the grid loads perfectly fine showing those 4 records and showing 5 pages, that would equate to 20 records total.

Now if I click a button, on whose click event the same method for loading the grid is fired, all the 4 records are shown, but the 5 pages shown at bottom disappears. It assumes only one page, even though the backend API continues to provide 20 records in the count attribute.

Please find at below link the issue that is reproduced.

https://jsfiddle.net/q0b2o68x/

Please let me know when can this issue be fixed?

Parents
No Data
Reply
  • 640
    Verified Answer
    Offline posted

    Hello Vaibhav,

    Thank you for your patience while I was looking into this matter for you.

    This issue is not related to the remote pagination or the external button. The reason for this behavior is because you are reinitializing the grid. What I would suggest you is to initialize the grid only one time and if you need to change its data sorce you can do it through the external button using the dataSource option of igGrid:

    function reloadData() {
      var url = "https://mocki.io/v1/f7970ac8-9f6e-4a87-b260-c2f2ed352e8c";
      ds = new $.ig.DataSource({
        type: "remoteUrl",
        dataSource: url,
        schema: oDataSchema,
        responseDataKey: "items",
        responseDataType: "json",
        responseContentType: "application/json; charset=utf-8"
      }).dataBind();
      $("#grid").igGrid("option", "dataSource", ds)
    }

    Here you can find a small sample demonstrating my suggestion. Please test it on your side and let me know whether you find it helpful.

    Looking forward to hearing from you.

    Regards,
    Viktor Kombov
    Entry Level Software Developer
    Infragistics, Inc.

Children