0
votes

I'm using the AG-Grid infinite scrolling row model in Angular, by following the example from Here

When running the above example, I can see in the developer tools that the page number gets logged out:

enter image description here

However I cannot seem to find a way to get the page number in my code. I've tried paginationGetCurrentPage(), however that doesn't appear to work with the infinite scrolling row model.

Is there any way to get the page number being requested when the getRows functions is fired? My api expects a page number to retrieve data, rather than a start and end row number.

1

1 Answers

2
votes

It's just simple math you need to do to get the page number inside getRows.

let pageNo = 1;
if (this.paginationPageSize != undefined)
   pageNo = params.startRow / this.paginationPageSize + 1;
// use pageNo to make API request
console.log('pageNo: ' + pageNo);

Check this plunk I've created. Observe the browser logs.