Search.../

hasPreviousPage( )

Indicates if there is a previous page of data.

Description

Returns true if the current page is not the first page in the dataset.

Returns false if the current page is the first page in the dataset.

Calling hasPreviousPage() on a write-only dataset causes an error.

Note:

A dataset needs to load its data before you call its hasPreviousPage() function. Usually a dataset finishes loading a short time after the page it is on finishes loading. So if you call hasPreviousPage() inside the page’s onReady() event handler, the dataset might not be ready yet.

To call hasPreviousPage() as soon as possible after a page loads, use the dataset's onReady() function inside the page’s onReady() event handler to ensure that both the page and the dataset have finished loading.

Syntax

function hasPreviousPage(): boolean

hasPreviousPage Parameters

This function does not take any parameters.

Returns

true if the current page is not the first page in the dataset.

Return Type:

boolean
Mixed in from:wix-dataset.Dataset

Was this helpful?

Get whether the current page is the first page of data

Code Example

Copy Code
1let hasPreviousPage = $w("#myDataset").hasPreviousPage(); // true
Get whether the current page is the first page of data when the page loads

Code Example

Copy Code
1$w.onReady( () => {
2 $w("#myDataset").onReady( () => {
3 let hasPreviousPage = $w("#myDataset").hasPreviousPage(); // true
4
5 } );
6
7} );