refresh( )
Refetches the contents of the dataset from the collection.
Description
The refresh()
function returns a Promise that is resolved
when:
- The dataset's contents are refetched from the collection, discarding current edits.
- Any connected page elements have been updated with the values from the collection (read & write mode) or blank values (write-only mode).
Refreshing the dataset sets the current item back to the first item in the dataset regardless of what the current item was before refreshing.
Note:
A dataset needs to load its data before you call its
refresh()
function. Usually a dataset finishes loading a short time after the page it is on finishes loading. So if you callrefresh()
inside the page’sonReady()
event handler, the dataset might not be ready yet.To call
refresh()
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.
Authorization
Request
This endpoint does not take any parameters
Response Object
Fulfilled - When the refresh is finished. Rejected - An error message.
Returns an empty object.
Status/Error Codes
Was this helpful?
1$w("#myDataset").refresh()2 .then( () => {3 console.log("Done refreshing the dataset");4 } );
1$w.onReady( () => {2 $w("#myDataset").onReady( () => {3 $w("#myDataset").refresh()4 .then( () => {5 console.log("Done refreshing the dataset");6 } );78 } );910} );