# Desperately finding a solution to delete rows in Collections 

**URL:** <https://forum.wixstudio.com/t/desperately-finding-a-solution-to-delete-rows-in-collections/5783>\
**Category:** Ask the community\
**Tags:** question, code\
**Created:** [July 27, 2018, 10:49am UTC](https://forum.wixstudio.com/t/desperately-finding-a-solution-to-delete-rows-in-collections/5783 "2018-07-27T10:49:22Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![dilly](https://avatars.discourse-cdn.com/v4/letter/d/c37758/32.png) [@dilly](https://forum.wixstudio.com/u/dilly)\
**Post date:** [July 27, 2018, 10:49am UTC](https://forum.wixstudio.com/t/desperately-finding-a-solution-to-delete-rows-in-collections/5783/1 "2018-07-27T10:49:22Z")

</div>

Hi,

Can you please help me.

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.

> **[How to delete the item on my database collection? | Velo by Wix](https://community.wix.com/velo/forum/coding-with-velo/how-to-delete-the-item-on-my-database-collection)**
>
> I want to delete the items on my database collection from sandbox to live data collection

> **[All Row Delete in Collections | Velo by Wix](https://community.wix.com/velo/forum/coding-with-velo/all-row-delete-in-collections)**
>
> Hi,
> 
> I been using this query for deleting all records in the collection. Its working fine. But not all in one extent. After sometime its getting stopped and when we press the button its going one by one
> 
> import wixData from...

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](https://www.wix.com/code/home/forum/search/posts%3Fquery=%23dynamicDataset) "); _// or the name of your dataset_  
dataset.onReady( **async** () **=\>** {  
while (dataset.getCurrentItem()) {  
await dataset.remove(); } });  
dataset.refresh();  
}

1. Pressed preview

When I go to the Dresses Collection all the items are there. Not deleted.

 ![](https://us1.discourse-cdn.com/wix/original/3X/a/c/acedaa83e2ce7d3eba9ba4b168158dfac9c47ef5.jpeg)

 ![](https://us1.discourse-cdn.com/wix/original/3X/d/5/d5d7b25739a8932c9292429155d744ddd16c8dda.jpeg)  
Clicked preview

 ![](https://us1.discourse-cdn.com/wix/original/3X/c/6/c61dcc3b6014297bc04b7ac4d6fc3cfc33ff7f40.jpeg)

Please tell me what I am doing wrong here.

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.

---

<div class="post-metadata">

**Author:** ![andreas-kviby](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/andreas-kviby/32/790_2.png) [@andreas-kviby](https://forum.wixstudio.com/u/andreas-kviby)\
**Post date:** [July 27, 2018, 11:08am UTC](https://forum.wixstudio.com/t/desperately-finding-a-solution-to-delete-rows-in-collections/5783/2 "2018-07-27T11:08:53Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dilly](https://avatars.discourse-cdn.com/v4/letter/d/c37758/32.png) [@dilly](https://forum.wixstudio.com/u/dilly)\
**Post date:** [July 27, 2018, 11:17am UTC](https://forum.wixstudio.com/t/desperately-finding-a-solution-to-delete-rows-in-collections/5783/3 "2018-07-27T11:17:07Z")

</div>

Thank you Andreas for your reply.

I clicked on “Dresses” “Edit permissions” this is what is see.

Is this correct?

 ![](https://us1.discourse-cdn.com/wix/original/3X/b/0/b0abcc98383124a0c8b2d1a08c21f60d6675e852.jpeg)

---

<div class="post-metadata">

**Author:** ![andreas-kviby](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/andreas-kviby/32/790_2.png) [@andreas-kviby](https://forum.wixstudio.com/u/andreas-kviby)\
**Post date:** [July 27, 2018, 11:21am UTC](https://forum.wixstudio.com/t/desperately-finding-a-solution-to-delete-rows-in-collections/5783/4 "2018-07-27T11:21:18Z")

</div>

Just try to change DLETE to Site Member and click Preview and see if that works.

---

<div class="post-metadata">

**Author:** ![dilly](https://avatars.discourse-cdn.com/v4/letter/d/c37758/32.png) [@dilly](https://forum.wixstudio.com/u/dilly)\
**Post date:** [July 27, 2018, 11:27am UTC](https://forum.wixstudio.com/t/desperately-finding-a-solution-to-delete-rows-in-collections/5783/5 "2018-07-27T11:27:40Z")

</div>

That is not not working either. Do you think I have entered the code in the right place? just noticed a red dot.

 ![](https://us1.discourse-cdn.com/wix/original/3X/0/0/0036dff2b8f67f6c32823158a9a6503b4696c79c.jpeg)

---

<div class="post-metadata">

**Author:** ![dilly](https://avatars.discourse-cdn.com/v4/letter/d/c37758/32.png) [@dilly](https://forum.wixstudio.com/u/dilly)\
**Post date:** [July 27, 2018, 11:29am UTC](https://forum.wixstudio.com/t/desperately-finding-a-solution-to-delete-rows-in-collections/5783/6 "2018-07-27T11:29:09Z")

</div>

I do not know what to do…

---

<div class="post-metadata">

**Author:** ![andreas-kviby](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/andreas-kviby/32/790_2.png) [@andreas-kviby](https://forum.wixstudio.com/u/andreas-kviby)\
**Post date:** [July 27, 2018, 11:52am UTC](https://forum.wixstudio.com/t/desperately-finding-a-solution-to-delete-rows-in-collections/5783/7 "2018-07-27T11:52:01Z")

</div>

Hey  
On line 12 you have one } to much I guess. Take that out.

---

<div class="post-metadata">

**Author:** ![dilly](https://avatars.discourse-cdn.com/v4/letter/d/c37758/32.png) [@dilly](https://forum.wixstudio.com/u/dilly)\
**Post date:** [July 27, 2018, 12:04pm UTC](https://forum.wixstudio.com/t/desperately-finding-a-solution-to-delete-rows-in-collections/5783/8 "2018-07-27T12:04:25Z")

</div>

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.

 ![](https://us1.discourse-cdn.com/wix/original/3X/0/5/056a79597b0b867e070374eb90de81092cafc244.jpeg)

 ![](https://us1.discourse-cdn.com/wix/original/3X/b/8/b8ca31cbb1e04550f03985049f2c9bf6d89359b1.jpeg)

---

<div class="post-metadata">

**Author:** ![andreas-kviby](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/andreas-kviby/32/790_2.png) [@andreas-kviby](https://forum.wixstudio.com/u/andreas-kviby)\
**Post date:** [July 27, 2018, 12:25pm UTC](https://forum.wixstudio.com/t/desperately-finding-a-solution-to-delete-rows-in-collections/5783/9 "2018-07-27T12:25:40Z")

</div>

if you click Manage Dataset on the dataset what rights do you have there? Read or read & Write?

---

<div class="post-metadata">

**Author:** ![dilly](https://avatars.discourse-cdn.com/v4/letter/d/c37758/32.png) [@dilly](https://forum.wixstudio.com/u/dilly)\
**Post date:** [July 27, 2018, 12:33pm UTC](https://forum.wixstudio.com/t/desperately-finding-a-solution-to-delete-rows-in-collections/5783/10 "2018-07-27T12:33:26Z")

</div>

Read and Write

---

<div class="post-metadata">

**Author:** ![dilly](https://avatars.discourse-cdn.com/v4/letter/d/c37758/32.png) [@dilly](https://forum.wixstudio.com/u/dilly)\
**Post date:** [July 27, 2018, 12:35pm UTC](https://forum.wixstudio.com/t/desperately-finding-a-solution-to-delete-rows-in-collections/5783/11 "2018-07-27T12:35:54Z")

</div>

In the properties, under which event do i need to paste the code?

---

<div class="post-metadata">

**Author:** ![dilly](https://avatars.discourse-cdn.com/v4/letter/d/c37758/32.png) [@dilly](https://forum.wixstudio.com/u/dilly)\
**Post date:** [July 27, 2018, 12:38pm UTC](https://forum.wixstudio.com/t/desperately-finding-a-solution-to-delete-rows-in-collections/5783/12 "2018-07-27T12:38:17Z")

</div>

I spend whole day yesterday trying to find and answer and since this morning. I am very grateful for your messages.

---

<div class="post-metadata">

**Author:** ![dilly](https://avatars.discourse-cdn.com/v4/letter/d/c37758/32.png) [@dilly](https://forum.wixstudio.com/u/dilly)\
**Post date:** [July 27, 2018, 12:51pm UTC](https://forum.wixstudio.com/t/desperately-finding-a-solution-to-delete-rows-in-collections/5783/13 "2018-07-27T12:51:41Z")

</div>

maybe I am not entering the code in the correct place.  
If it is possible can you please write down the instructions step by step. Many thanks.

---

<div class="post-metadata">

**Author:** ![andreas-kviby](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/andreas-kviby/32/790_2.png) [@andreas-kviby](https://forum.wixstudio.com/u/andreas-kviby)\
**Post date:** [July 27, 2018, 2:35pm UTC](https://forum.wixstudio.com/t/desperately-finding-a-solution-to-delete-rows-in-collections/5783/14 "2018-07-27T14:35:34Z")

</div>

> **[All Row Delete in Collections | Velo by Wix](https://community.wix.com/velo/forum/coding-with-velo/all-row-delete-in-collections)**
>
> Hi,
> 
> I been using this query for deleting all records in the collection. Its working fine. But not all in one extent. After sometime its getting stopped and when we press the button its going one by one
> 
> import wixData from...

---

<div class="post-metadata">

**Author:** ![dilly](https://avatars.discourse-cdn.com/v4/letter/d/c37758/32.png) [@dilly](https://forum.wixstudio.com/u/dilly)\
**Post date:** [July 27, 2018, 3:01pm UTC](https://forum.wixstudio.com/t/desperately-finding-a-solution-to-delete-rows-in-collections/5783/15 "2018-07-27T15:01:13Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dilly](https://avatars.discourse-cdn.com/v4/letter/d/c37758/32.png) [@dilly](https://forum.wixstudio.com/u/dilly)\
**Post date:** [July 27, 2018, 3:02pm UTC](https://forum.wixstudio.com/t/desperately-finding-a-solution-to-delete-rows-in-collections/5783/16 "2018-07-27T15:02:52Z")

</div>

There a no videos on YouTube either about deleting rows on collection.

---

<div class="post-metadata">

**Author:** ![contactrussh](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/contactrussh/32/16601_2.png) [@contactrussh](https://forum.wixstudio.com/u/contactrussh)\
**Post date:** [January 5, 2020, 8:31am UTC](https://forum.wixstudio.com/t/desperately-finding-a-solution-to-delete-rows-in-collections/5783/17 "2020-01-05T08:31:45Z")

</div>

Was this issue resolved and solution available as we are facing the exact problem. Desperately looking for solution.

---

<div class="post-metadata">

**Author:** ![yisrael-wix](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/yisrael-wix/32/1107_2.png) [@yisrael-wix](https://forum.wixstudio.com/u/yisrael-wix)\
**Post date:** [January 5, 2020, 8:55am UTC](https://forum.wixstudio.com/t/desperately-finding-a-solution-to-delete-rows-in-collections/5783/18 "2020-01-05T08:55:51Z")

</div>

This is an old thread. Please repost your question so that you’ll have a better chance of getting answers.
