Search.../

prev( )

Retrieves the previous page of query results.

Description

The prev() function retrieves the previous page of query results.

The page size is defined by the limit() function, can be retrieved using the pageSize property, and navigating through pages is done with the prev() and next() functions.

If items are added or removed between calls to prev() the values returned may change.

Syntax

function prev(): Promise<PublicPlansQueryResult>

prev Parameters

This function does not take any parameters.

Returns

Fulfilled - A query result object with the previous page of query results. Rejected - The errors that caused the rejection.

Return Type:

Was this helpful?

Get the previous page of a query result

Copy Code
1oldResults.prev()
2 .then((results) => {
3 const newResults = results;
4 const items = newResults.items;
5 const firstItem = items[0];
6 const totalCount = newResults.totalCount;
7 const pageSize = newResults.pageSize;
8 const currentPage = newResults.currentPage;
9 const totalPages = newResults.totalPages;
10 const hasNext = newResults.hasNext();
11 const hasPrev = newResults.hasPrev();
12 const length = newResults.length;
13 const query = newResults.query;
14 })
15 .catch((error) => {
16 const queryError = error;
17 });