How to disable cache for ag-grid when paging to previous pages

Viewed 1800

I'm using ag-grid with server-side row model and pagination, just the previous and next buttons, no scrolling. I want ag-grid to load data (so calling getRows()) on every click to next and previous. It works fine for next page but the data for previous page is never loaded again from server.

I'm using this config properties for pagination and cache:

rowModelType: 'serverSide',
pagination: true,
paginationPageSize: 10,
cacheBlockSize: 10,
maxBlocksInCache: 0

More or less completely disabling cache on client side. Any hint how to accomplish that?

1 Answers

Here is your solution:

 maxBlocksInCache = 1;

cacheBlockSize - should be the same as paginationPageSize (cuz it would one visible 'scope' - for block storage, so remember to bind it to one property) and then - block storage is a maxBlocksInCache - should be the one only (cuz one visible block is equal to one block in cache)

rowModelType: 'serverSide',
pagination: true,
paginationPageSize: 10,
cacheBlockSize: 10,
maxBlocksInCache: 1

Demo

Related