# Delete selected Row not working

**URL:** <https://community.glideapps.com/t/delete-selected-row-not-working/65633>\
**Category:** Ask for Help\
**Created:** [August 31, 2023, 2:11pm UTC](https://community.glideapps.com/t/delete-selected-row-not-working/65633 "2023-08-31T14:11:55Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Benjamin\_Rb](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/benjamin_rb/32/63494_2.png) [@Benjamin\_Rb](https://community.glideapps.com/u/Benjamin_Rb)\
**Post date:** [August 31, 2023, 2:11pm UTC](https://community.glideapps.com/t/delete-selected-row-not-working/65633/1 "2023-08-31T14:11:55Z")

</div>

I want to be able to allow the user to delete some row in a table.  
So I created a booleen column in the data table.  
This column allow the user to select or not the row.

Then a created a button with a condition : " if Selectionner is checked delete Row"

I do not understand the result.  
When the user select/check the first row the button is visible and if the user press it, it delete the row properly.  
When the user slect another row (the second one, or third one or any other), the button is not visible and so it is not possible to delete the row.

Any explaination ?And any solution to that problem ?

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [August 31, 2023, 2:21pm UTC](https://community.glideapps.com/t/delete-selected-row-not-working/65633/2 "2023-08-31T14:21:42Z")

</div>

Are you trying to do this with a Data Grid component?

Sounds like your condition is applying to the screen, which is attached to the first row in the table, which is why your button only appears when the boolean in the first row is checked.

---

<div class="post-metadata">

**Author:** ![Benjamin\_Rb](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/benjamin_rb/32/63494_2.png) [@Benjamin\_Rb](https://community.glideapps.com/u/Benjamin_Rb)\
**Post date:** [August 31, 2023, 2:35pm UTC](https://community.glideapps.com/t/delete-selected-row-not-working/65633/3 "2023-08-31T14:35:58Z")

</div>

I tried to do it both with the data grid actions options and with a component “button”.  
The result is the same.

![Capture delete row condition](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/5/7/57202fd9cf79c4347155ebfd32aef47f3e5b2ef1.jpeg)

 ![Capture2](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/4/5/45fdc6015b9ee28abbe27dd212d15bacd1584850.jpeg)  
 ![Capture3](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/5/2/52fe094357b80d8f391fc2b3571d2afd17ee5cee.jpeg)  
 ![Capture4](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/d/1/d14b636b410bb5d7ad4aa4e75991358b19d092c4.jpeg)

I don’t understand what do you mean by “Sounds like your condition is applying to the screen”

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [August 31, 2023, 2:42pm UTC](https://community.glideapps.com/t/delete-selected-row-not-working/65633/4 "2023-08-31T14:42:09Z")

</div>

> [@Benjamin\_Rb](#):
>
> I don’t understand what do you mean by “Sounds like your condition is applying to the screen”

Your button is attached to the screen, not the Data Grid. So it’s attached to the first row in the table. This means that the condition in the action is only checking the first row.

To do what you are trying to do, you would have to set it up as follows:

- Start by adding a Template column with just the word `true`
- Next create a Relation column that matches that Template column with your boolean column. This can either be a single relation or a multiple relation. If you make it a single relation, then only the first checked row will be deleted. If you make it a multiple relation, then _all_ checked rows will be deleted.
- Now change your custom action as follows:  
– Make the condition “if relation is not empty”  
– And change the Delete Row from This Item to instead delete via the relation.

If you make the above changes, you should get what you are looking for.

---

<div class="post-metadata">

**Author:** ![Benjamin\_Rb](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/benjamin_rb/32/63494_2.png) [@Benjamin\_Rb](https://community.glideapps.com/u/Benjamin_Rb)\
**Post date:** [August 31, 2023, 3:41pm UTC](https://community.glideapps.com/t/delete-selected-row-not-working/65633/5 "2023-08-31T15:41:38Z")

</div>

Here is what I did. But the result is the button appears only when the first row is checked.  
Otherwise it doesn’t appears

 ![Capture5](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/8/0/80b03a08860c04850a9741f5956118089eea5d9c.jpeg)  
 ![Capture6](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/6/0/60016093aa08bd0b3ac34ae99f2502b4bbbb01a4.jpeg)  
 ![Capture7](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/0/d/0dea4e20d18d6d75dec683441c8021c3a8ea1d23.jpeg)

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [August 31, 2023, 3:44pm UTC](https://community.glideapps.com/t/delete-selected-row-not-working/65633/6 "2023-08-31T15:44:47Z")

</div>

You have the relation around the wrong way. You need to select the template column first, and then match it with the boolean column.

 ![CleanShot 2023-08-31 at 23.42.21@2x](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/1/7/1781c206929caca6f60d3a659b45f3cc29c96b47.jpeg)

---

<div class="post-metadata">

**Author:** ![Benjamin\_Rb](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/benjamin_rb/32/63494_2.png) [@Benjamin\_Rb](https://community.glideapps.com/u/Benjamin_Rb)\
**Post date:** [August 31, 2023, 3:55pm UTC](https://community.glideapps.com/t/delete-selected-row-not-working/65633/7 "2023-08-31T15:55:30Z")

</div>

Perfect it works !!  
Thank you for your help

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/system/32/53398_2.png) [@system](https://community.glideapps.com/u/system)\
**Post date:** [September 7, 2023, 3:56pm UTC](https://community.glideapps.com/t/delete-selected-row-not-working/65633/8 "2023-09-07T15:56:17Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
