Search.../

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 call remove() inside the page’s onReady() event handler, the dataset might not be ready yet.

To call remove() 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 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:

Promise<void>
Mixed in from:wix-dataset.Dataset

Related Content:

Was this helpful?

Remove the current item

Code Example

Copy Code
1$w("#myDataset").remove()
2 .then( () => {
3 console.log("Done removing current item");
4 } );
Remove the current item when the page loads

Code Example

Copy Code
1$w.onReady( () => {
2 $w("#myDataset").onReady( () => {
3 $w("#myDataset").remove()
4 .then( () => {
5 console.log("Done removing current item");
6 } );
7
8 } );
9
10} );