prev( )


Retrieves the previous page of search results.

The prev() function retrieves the previous page of search 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.

Method Declaration
Copy
function prev(): Promise<WixSearchResult>;
Request
This method does not take any parameters
Returns
Return Type:Promise<WixSearchResult>
Get the previous page of a search result
JavaScript
oldResults .prev() .then((results) => { let newResults = results; let documents = newResults.documents; let firstDocument = documents[0]; let facets = results.facets; let totalCount = newResults.totalCount; let pageSize = newResults.pageSize; let currentPage = newResults.currentPage; let totalPages = newResults.totalPages; let hasNext = newResults.hasNext(); let hasPrev = newResults.hasPrev(); let length = newResults.length; }) .catch((error) => { console.log(error); });
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?