Search.../

loadMore( )

Loads the next page of data in addition to the current data.

Description

The loadMore() function returns a Promise that is resolved when:

  • The dataset loads the next page of data.
  • Any connected elements have been updated with the new data.

Loading more data into a dataset adds more items to any connected repeaters. Elements that have their own settings for how many items are shown at once, such as tables and galleries, are not affected.

Loading more data into a dataset does not:

  • Remove any of the items that were previously shown in any connected elements
  • Change the dataset's page size.
  • Change the dataset's current item.

Note:

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

To call loadMore() 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 loadMore(): Promise<void>

loadMore Parameters

This function does not take any parameters.

Returns

Fulfilled - When the additional data has been loaded and any connected repeaters have been updated. Rejected - An error message.

Return Type:

Promise<void>

Was this helpful?

Load more dataset content

Code Example

Copy Code
1$w("#myDataset").loadMore()
2 .then( () => {
3 console.log("Done loading more data");
4 } );
Load more dataset content when the page loads

Code Example

Copy Code
1$w.onReady( () => {
2 $w("#myDataset").onReady( () => {
3 $w("#myDataset").loadMore()
4 .then( () => {
5 console.log("Done loading more data");
6 } );
7
8 } );
9
10} );