getCurrentPageIndex( )

Gets the index of the dataset's current page.


The getCurrentPageIndex() function returns the index of current dataset page. The indices of the dataset's pages start at 1.


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

To call getCurrentPageIndex() 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.


function getCurrentPageIndex(): number

getCurrentPageIndex Parameters

This function does not take any parameters.


The index of the current page or null if there is no current page.

Return Type:


Was this helpful?

Get the current page's index

Copy Code
1let pageCount = $w("#myDataset").getCurrentPageIndex(); // 1