0

I am using igx-grid. I am retrieving all data in one call, suppose I am on 3rd page, while filtering data it searching the data from the whole data, and it goes to "Page 1" automatically, I need a way to filter data in current page only and don't paginate to Page 1, it should be on current page only. Is there any way to do the same? Thanks in advance!!!

Edit: I am facing same issue in Server Side Pagination also.

1 Answers1

1

Filtering performed on the data in any column of the igx-grid is not an operation which works only on the specific page data, but on the entire data set. If you need only data within the current page to be filtered, then the data within the current page will be less than the page size and the data state in general in the grid will go out of sync.

In order to get the current filtered data on the current page with server-side paging, you can extract the filteringExpressions from the grid and send them in the request for paging to your backend service. Then first filter the data and subsequently page it and return only the page size back. In pseudo code this will look something like:

data.Where(d => d.something meets condition).Skip(page).Take(pageSize)

The result would be something like this: https://stackblitz.com/edit/github-w6x6a7?file=src/app/grid/grid-remote-paging-defaultTemplate-sample/remote-paging-default-template.component.html

Now the grid does reset the pages when client-side filtering is performed, because when filtering the data, the number of pages is reduced and the current page that the user is on may no longer exist.

Examples on the server-side paging and filtering in the igx-grid can be found here: https://www.infragistics.com/products/ignite-ui-angular/angular/components/grid/remote-data-operations

Konstantin Dinev
  • 34,219
  • 14
  • 75
  • 100
  • I checked your stackblitz app, there is one issue which I was also facing the same in filtering. While filtering the data, it doesn't filter the data of any current page, it filtering the data of only first page whether we are on 2nd page or 3rd page or 100th page. You can check your stackblitz. Thanks –  May 11 '21 at 04:44
  • and I don't have any api for filtering the data, I want SSP and filtering on the current page or current data set, The problem I am facing, when I am on 3rd page and on 3rd page if I am filtering the data, it moves to the first page and after that again api is hitting for the 1st page, and I lost my 3rd page data and I didn't getting filtered data. –  May 11 '21 at 04:57
  • do you have any stackblitz which having server side pagination with non server side filtering? –  May 11 '21 at 06:46