Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I set the initial start page in the infinite row model?

I'm using the Ag-Grid version 20.0.0 with the Infinite row model and pagination enable. I want to be able to set the initial page for the first load but I don't see any property that allows me to customize that. They only provide the method paginationGoToPage to change the page but this method requires that the grid has been loaded first, and this force me to do two calls, one for the first time (page 0) and the second one to the page that I really want.

like image 348
David Avatar asked Nov 16 '22 09:11

David


1 Answers

ag-grid (community edition v21 in my case) does not provide such a feature out of the box. The infinite row model always gets first row "to kick things of". To achieve the desired behavior, you have to either:

  1. Implement a custom row model. The docs do not describe how to even start with such an endeavor, but I believe it would be the most idiomatic and self-contained approach.
  2. Work around the infinite row model to trick it into the desired behavior. I managed to partially achieve this with an Angular directive that syncs URL and grid page and a special datasource base class, but could not solve some edge case issue, like a missing first page data.
like image 194
Klaster_1 Avatar answered Dec 09 '22 15:12

Klaster_1