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.
Note: The
prev()
function is not supported for Single Item Collections.
Syntax
function prev(): Promise<WixDataQueryResult>
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:
Promise<WixDataQueryResult>
Was this helpful?
Get the previous page of a query result
Copy Code
1oldResults.prev()2 .then((results) => {3 let newResults = results;4 let items = newResults.items;5 let firstItem = items[0];6 let totalCount = newResults.totalCount;7 let pageSize = newResults.pageSize;8 let currentPage = newResults.currentPage;9 let totalPages = newResults.totalPages;10 let hasNext = newResults.hasNext();11 let hasPrev = newResults.hasPrev();12 let length = newResults.length;13 let query = newResults.query;14 })15 .catch((error) => {16 let errorMsg = error.message;17 let code = error.code;18 });