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.
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});
Hello gvi.
From 2015.1 we are exposing "persist" option for the paging feature and you can just set it as an option and it won't retain paging state(pageIndex and pageSize will be reset).
In your second post I saw, that you are using filtering, for this feature we already have persist option. So if you disable it persist: false (http://help.infragistics.com/jQuery/2014.2/ui.iggridfiltering#options:persist), filtering state won't be preserved after dataBinding.
What you can do to not have two requests - one for requesting data and one for changing page index, is to set currentPageIndex in the data of the igGridPaging.
$('.selector').data('igGridPaging').options.currentPageIndex = 0;
And then do the data binding.
Note that setting the currentPageIndex though the data won't be applied before the data binding.
Hi Deyan,
I implemented your solution and everything is working perfectly.
Thank you very much for this proper solution :-)
Hello gvi,
if you have any additional questions on this matter, please don't hesitate to contact us.