Search code examples
ag-gridag-grid-angular

ServerSideRowModel - Remove filters and sorting at once without causing calls to `dataSource.getRows` twice


We have a scenario where we need to remove column filter and sorting and then purgeServerSideCache.

Issue with that is, when we do filterManager.setFilterModel(null) and then gridApi.setSortModel(null), two separate calls for dataSource.getRows are getting fired - which I would like to avoid.

What can I do to remove filter model and sort model so that dataSource.getRows method gets called only once?


Solution

  • As mentioned in the documentation, https://www.ag-grid.com/javascript-grid-server-side-model-configuration/#configurations,

    blockLoadDebounceMillis: Prevents blocks loading until scrolling has stopped for the specified number of milliseconds. When row count (i.e. lastRowIndex) is known, setting this property will enable skipping over blocks when scrolling.

    blockLoadDebounceMillis of gridOptions can be used to set debounce timing for scrolling. Same can also be used here. Ultimately it is used to set debounce timing for dataSource.getRows method.