Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

ag-grid

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?

like image 574
Christof Aenderl Avatar asked Oct 28 '25 09:10

Christof Aenderl


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

like image 164
un.spike Avatar answered Oct 30 '25 15:10

un.spike



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!