0
votes

Really need help on this, please.

Brief: I have implemented ag-grid serverside mode with partial store for lazy loading.

Problem Scenario : ServerSide mode, what happens is as you scroll more data is loaded, in terms of ag-grid more row blocks are loaded.

Lets say block size is 100 rows. I scrolled 5-6 times, 5-6 request went to the server , loaded the data into the grid using success callback of getRows method in ServerSideDataSource Implementation.

You are currently viewing 500th-600th row in your viewport(the last request that went to server).

If you go and apply a fresh/change-existing filter on a column, the getRows method will get called but with request params having startRow 500 and endRow 600(rowBlock you are currently viewing).

This is the issue. I want that to be 0 and 100 respectively as you generally implement server-side filtering. It should be a fresh request to server right. ag-grid should recognise a new filter got applied so dump the existing rows on the grid send fresh request to server with 0 and 100 values.

This start and end row values are fine when you have already loaded data with filter applied till 500 and scrolling to load 500-600. But when the filter is first applied/ freshly applied(change from existing filter/ newly applied) you need the start and end rows to be 0 and 100 right. Help!!

1

1 Answers

1
votes

Hi i came across this question while searching for this exact problem, looking around to the docs and couldn't find solution there. It's happening after they introduce serverSideStoreType: "partial | full".

my current workaround for this is to updating params.request.filterModel on your getRows datasource, if detect any changes on filterModel

getRows: function (params) {
  //update startRow to 0 then detect changes
  if(grid.filterModel != JSON.stringify(params.request.filterModel) ){
    params.request.startRow = 0;
  }
  grid.filterModel =  JSON.stringify(params.request.filterModel);