0
votes

I am using ag-grid, Angular 7 and the server-side datasource with pagination.

The way my api works is that I fire two requests, the first one gives me the total table item count, and the second retrieves the desire page data.

For now, I am waiting for the count request response, and setting up the datasource, firing the request that gets the data.

The only way I know to tell the grid the total items count is through params.successCallback(data, lastRow)

Is it possible to set the last row independently ? For example with a setLastRow() method ?

2

2 Answers

1
votes

Your analysis is correct, there is now way to set the number of rows other than setting it successCallback() method. Please don't use Viewport RowModel as suggested in another response here, it's not a good reason to jump row models!, just keep the row count stored in your app, and pass it to successCallback() when you do call it.

0
votes

Method

// datasource calls this method when the total row count changes. 
// This in turn sets the height of the grids vertical scroll.
setRowCount: (count:number) => void;

available in View Port Row Model.

If you can switch to it, you could set total count before your retrieve data.

more here https://www.ag-grid.com/javascript-grid-viewport/