remove( )
Removes the current item.
Description
The remove()
function returns a Promise that is resolved
when:
- The current item is deleted in the collection.
- Any connected page elements have been updated with the next item’s values if there is a next item, or the previous item's values if the removed item was the last item.
Calling remove()
on a write-only or read-only dataset causes an error.
Note:
A dataset needs to load its data before you call its
remove()
function. Usually a dataset finishes loading a short time after the page it is on finishes loading. So if you callremove()
inside the page’sonReady()
event handler, the dataset might not be ready yet.To call
remove()
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 remove(): Promise<void>
remove Parameters
This function does not take any parameters.
Returns
Fulfilled - When the current item has been removed from the collection.
Return Type:
Related Content:
Was this helpful?
1$w("#myDataset").remove()2 .then( () => {3 console.log("Done removing current item");4 } );
1$w.onReady( () => {2 $w("#myDataset").onReady( () => {3 $w("#myDataset").remove()4 .then( () => {5 console.log("Done removing current item");6 } );78 } );910} );