Home > widget-integration > FilterService > processPagination
FilterService.processPagination() method
Updates pagination state and fetches new page of results.
Handles page navigation, URL parameter updates, and triggers API fetch with the specified behavior. Updates session storage for persistence.
Signature:
processPagination(newPage: number, behavior?: "more" | "previous" | "replace"): Promise<void>;
Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
newPage |
number |
The new page number to navigate to |
|
behavior |
"more" | "previous" | "replace" |
(Optional) Fetch behavior determining how results are displayed: - 'replace': Replace current results (default) - 'more': Append to existing results (infinite scroll) - 'previous': Prepend to existing results |
Returns:
Promise<void>
Promise that resolves when pagination is complete
Remarks
Automatically updates URL with new page parameter and stores page in session storage. Handles URL shortening if enabled.
Example
Override to add custom pagination tracking:
async processPagination(newPage, behavior = 'replace') {
// Track pagination for analytics
this.analytics.track('page_changed', {
page: newPage,
behavior,
filterCount: this.getActiveFilterCount()
});
return super.processPagination(newPage, behavior);
}