Hi,
Is there anyone has a tutorial how to create a delete button that delete the data from data collection.???
Hi,
Check out this reference .
Create an onClick event to the button and use remove method.
Good luck!
Roi
Hi,
Its not working , I think my code is not totally right, pls help
this is my code
import wixData from ‘wix-data’;
export function button34_click(event, $w) {
if ($w(“#dynamicDataset”).getCurrentItem()) {
wixData.remove(“Profile”, “itemId”)
.then( (results) => {
let item = results; //see item below
} )
.catch( (err) => {
let errorMsg = err;
} );
}
}
this is the error when i run in preview
DatasetError: Operation (getCurrentItem) not allowed on an unconfigured datasetremove operation failed: DatasetError: The dataset didn’t load yet. You need to call remove inside the onReady for the dataset.
Hi,
In order to give a better assistance I need to understand some stuff.
Is it a button in a repeater ?
Is it in a dynamic page ?
Roi
Hi, Roi. I’m new here and was just playing around. Is there any civilized way to manipulate data in a collection programmaticly? for ex, delete duplicates and so on… If yes, where should i put my code to run it myself and not allow it for users. Will be really grateful for the respond!
@roi-bendet Hi Roi, I’m actually having a similar challenge and was wondering if you could provide some assistance. I want to allow the user of my website to “delete” themselves if they so desire. Although I know this is not entirely possible through wix as there is no user.delete code in the wix crm, can you provide some advice on how I can achieve a similar result while still being GDPR compliant?
I was thinking of creating a button that’s linked to the dataset where the user’s information is displayed and changing the submit button to delete, that way they can delete the information stored in the collection. But then how can I prevent the user from entering my site after this is completed? I tried using the blockbyuser function but it’s not working.
Any assistance you can provide would be greatly appreciated.