All Row Delete in Collections

there must be something I am doing wrong here and I do not know what it is!

Did you configure the dataset as write or read-write? If the dataset is read-only it won’t work.

I just changed it to Read and Write. clicked preview, clicked on the button but items are still in the collection

You should understand that using the dataset to delete all records takes some time and you will have to wait. You can try the wixData.query() method which is faster.

Do I need to change the “number of items to display” in the dataset as well?

This is what I see on preview. so do I have to leave on preview till the message disappear?

because I always come out of preview with out waiting.

You should see the console log output of x repeatedly displayed in the console. You need to wait, you can’t just go right out of preview.

If you are unable to figure this out, you might want to check out the WixArena - it’s a hub where you can look for Wix Code (and other) experts for hire.

This is where I am going wrong! I come out of preview.
I have no knowledge of coding. I used to import products to wix store via the import button on the store, but the button is no longer available. So I had to turn to creating every single page using wix code. For someone like me it was very hard. took me moths… I did think about speaking to someone at the arena but financially at the moment I am not in a situation to do that. I really appreciate that you are taking time to reply me.

“wixData.query() method which is faster” is this the second code you sent me? where do I need to paste this code please?

You can also use the query() code in the button onClick handler just like the dataset code. It’s faster, I’m just not sure how much faster.

Ok Sure. Thank you.

Just one one thing please. If you click on this link https://www.stylesweetsmile.com/dress and click on a Store name, you will notice it will take few seconds to go to the store page.

I want to show “All” and “Stores” in one page, but I could not find a way to do this.
So this is what I did:-

Created a Collection for Dresses

  1. added a Dynamic page under “Stores”
  2. Added Buttons on the left and linked each button to the relevant Store
  3. Linked the first Button “All” to and other page I created under “Ready to Wear” Called “Dresses”
  4. In this page I added a dataset and created a filter to show all dresses and pasted all the buttons from the dynamic to normal page.

is there any other way to show “All” and “Stores” in one page? Thanks

I used the first code to remove all the line from the database but nothing happened. do you have any idea why?

export function button190_click(event) {
wixData.query(“SessionLog”)
.limit(10)
.find()
.then((result) => {
for ( var i = 0; i < result.items.length; i++){
if (result.items[i] === null ) continue ;
wixData.remove(“SessionLog”, result.items[i]._id);
}
console.log(‘erase done’);
});
}