Delete entries in database

hello, i would like to know how to delete entries (by entries i mean rows) in my database on a click of a button.
does anyone know how to do this?


thank you in advance

Henry

See the remove() API with the accompanying example snippets.

@Henry

If you want an ON-PAGE solution then try something like this…

//delete items from a database with a delete button placed on the repeater

//link a repeater to the database that you want to delete items from

$w($w.onReady(function () {

// change the following varibles as required for your site (deleteButton1, dataset1, myCollection1)

//make sure the user has been given the correct permissions to allow deleting items from your collection/database

$w('#deleteButton1').onClick((event) => { 

    $w("#dataset1").onReady(() => { 

        //get ID for repeater item when clicked 

        let $item = $w.at(event.context); 
        let currentRant = $item("#dataset1").getCurrentItem(); 
        let itemID = `${currentRant._id}`; 

        console.log(itemID); 

        wixData.remove("myCollection1", itemID) 


        .then( () => { 

            console.log("item removed from collection/database"); 


         $w("#dataset1").refresh(); 

         }); 

    }) 
}) 

})