Delete dynamic repeater

Thankyou I will start on this
Regards Jer

Hi Tal,

I’ve followed your advice to the letter. No luck here. I’ve named the button ID’s in lightbox "OK and “Cancel”
I have also tried ‘ok’ ‘OK’ ‘cancel’ and ‘Cancel’ in the code. Lightbox closes when clicking either button but no removal of item even on refresh page. Is the code in “Top Comment” all that’s needed or am I missing something?

Thanks in advance

Hi everything works except the repeater item being removed from the screen and collection, where am i going wrong?
The delete button on the main page has been renamed Delete
The lightbox page name has been renamed DELETE
The lightbox close button is named Delete

Code on the main page
export function Delete(event, $w) {
let currentItem = $w(“#dataset1”).getCurrentItem();
wixWindow.openLightbox(‘DELETE’, currentItem)
.then((msg) => {
if (msg === ‘Delete’){
$w(“#dataset1”).remove();
}
});
}

code on the Lightbox page
import wixWindow from ‘wix-window’;

//TODO: write your page related code here…

export function Delete (event, $w) {
wixWindow.lightbox.close(‘Delete’);

}
export function Cancel_onClick(event, $w) {
wixWindow.lightbox.close(‘Cancel’);
}

thanks in advance, i hope someone sees this post soon
Adam

Hi i have tried using this combination of code. I can delete a repeater but really need to provide the option to delete via a popup, so i don’t know if anyone can help

if i delete this snippet
wixWindow.openLightbox(‘DELETE’, currentItem) .then((msg) => { if (msg === ‘delete’){

then it does work but obviously won’t link to a lightbox

export function Delete(event) {
wixWindow.openLightbox(‘DELETE’, currentItem)
.then((msg) => {
if (msg === ‘delete’){

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

//get ID for repeater item when clicked

let $item = $w.at(event.context);
let currentItem = $item(“#dataset1”).getCurrentItem();
let itemID = ${currentItem._id};

        console.log(itemID); 

        wixData.remove("MemberData", itemID) 


        .then( () => { 

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


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

         }); 

    }) 
}