I run a fashion website. I have 10 collections, each collection has near 8000 items. (8000 rows) Every couple of weeks I need to delete all the items (Rows )in each collection ( Sandbox and Live) and import new items.
At the moment I spend days purely highlighting rows and clicking the delete button. I am absolutely exhausted when it is all deleted.
I followed the instructions shown in these two links, but still no luck.
This is what I did:-
1)Opened a New page
2) Added a Dataset
3) connected the Dataset to “Dresses” (Collection Name)
4) Added the code
export function deleteAll_onClick(event, $w) {
let dataset = $w(" #dynamicDataset "); // or the name of your dataset
dataset.onReady( async () => {
while (dataset.getCurrentItem()) {
await dataset.remove(); } });
dataset.refresh();
}
Pressed preview
When I go to the Dresses Collection all the items are there. Not deleted.
Really appreciate your advice.
I have a very little knowledge about coding, so can you please write things down step by step. or with images.
Many thanks.
I think it is a permission thing, maybe you have setup permission to not permit DELETE. Right click your Data Collection and make sure you have the correct permissions.
I have deleted } as well. red dot disappeared. Thank you. Still items not deleted.
Can you kindly look at the image below and tell me where exactly i need to paste the code:
I thought to start from the beginning.
So, I have a collection called Dresses, and have created a Dynamic page - Dresses
Then I created a another page under menu called Dresses
I created a new page
Added a dataset, connected to Dresses collection. Which is the image you see below.
Thanks Andreas,
I sent a message yesterday to "Yisrael " as i copied the code that he provided. He has not mentioned where to paste the link. Haven’t heard anything from him yet. I could be pasting the link in the wrong area.