hasNext( )
Indicates if there is a next item.
Description
Returns true
if the current item is not the last item in the dataset.
Returns false
if the current item is the last item in the dataset.
Calling hasNext()
on a write-only dataset causes an error.
Note:
A dataset needs to load its data before you call its
hasNext()
function. Usually a dataset finishes loading a short time after the page it is on finishes loading. So if you callhasNext()
inside the page’sonReady()
event handler, the dataset might not be ready yet.To call
hasNext()
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 hasNext(): boolean
hasNext Parameters
This function does not take any parameters.
Returns
true
if the current item is not the last item in the dataset.
Return Type:
Related Content:
Was this helpful?
1let hasNext = $w("#myDataset").hasNext(); // true
1$w.onReady( () => {2 $w("#myDataset").onReady( () => {3 let hasNext = $w("#myDataset").hasNext(); // true45 } );67} );