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
650
Reset pageIndex when changing dataSource
posted

Hello,

I'm using the igGrid with the Remote Paging feature. In my application, the datasource URL can be modified with several parameters.

Problem : when I'm navigating to the page X, then I update the datasource with another URL. The grid stay on the page X and does not come back to page 0.

I tried to "force" the grid to reset the pageIndex to 0 before changing the datasource with the following line : $(".selector").igGrid("pageIndex", 0)

But it send a request to the server (expected behavior). Then changing the datasource itself sends another request to the server.

So my application is sending 2 requests when changing datasource ...

Is it possible to reset the pageIndex when changing datasource ?

Thank you in advance.

Parents
No Data
Reply
  • 650
    Suggested Answer
    posted

    I fixed the problem with the following code. Any better ideas ?

    var empty = [];
    $(".selector).igGrid({dataSource: empty});
    $(".selector).igGridPaging("pageIndex", 0);
    $(".selector).igGridFiltering("filter", []);

    $(".selector).igGrid({dataSource: url});

Children