getCurrentPageIndex( )
Gets the index of the dataset's current page.
Description
The getCurrentPageIndex()
function returns the index of current dataset
page. The indices of the dataset's pages start at 1
.
Note:
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 callgetCurrentPageIndex()
inside the page’sonReady()
event handler, the dataset might not be ready yet.To call
getCurrentPageIndex()
as soon as possible after a page loads, use the dataset'sonReady()
function inside the page’sonReady()
event handler to ensure that both the page and the dataset have finished loading.
Syntax
function getCurrentPageIndex(): number
getCurrentPageIndex Parameters
This function does not take any parameters.
Returns
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
1let pageCount = $w("#myDataset").getCurrentPageIndex(); // 1