Hello Corvid team,
I am hoping you can assist me with my below code to allow the user to delete an image in a media gallery which is connected to a dynamic dataset. However it doesn’t work… I have copied the code I have so far below with the notes.
/ For full API documentation, including code examples, visit Velo API Reference - Wix.com
import wixData from ‘wix-data’ ;
$w.onReady( function () {
/// the user selects an image in the gallery below which is already connected to 'dynamicDataset and that image title is stored
$w( “#gallery1” ).onItemClicked((event)=>{
console.log( "Gallery Item Title = " + event.item.title);
})
let image = // i need to get the image title to be stored in something here but am unable to;
// then below i am placing that title into the #input1 box
$w( ‘#input1’ ).value=image
//after i have stored the title into input1 box, trying to get the actual image to be stored in (‘#cover’)
$w( ‘#cover’ ).id
});
// then when the user clicks (‘#button2’) need that image to be deleted from the media gallery in the dynamicdataset below
// the user selects the button here
export function button2_click(event) {
let idToDelete = event.target._id;
//then remove the record from the collection
wixData.remove( ‘#dynamicDataset’ , idToDelete)
}
Greatly appreciate your assistance!