# Delete Row from a table

**URL:** <https://forum.inductiveautomation.com/t/delete-row-from-a-table/88730>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [April 12, 2024, 9:28am UTC](https://forum.inductiveautomation.com/t/delete-row-from-a-table/88730 "2024-04-12T09:28:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rachana\_Rudra](https://avatars.discourse-cdn.com/v4/letter/r/53a042/32.png) [@Rachana\_Rudra](https://forum.inductiveautomation.com/u/Rachana_Rudra)\
**Post date:** [April 12, 2024, 9:28am UTC](https://forum.inductiveautomation.com/t/delete-row-from-a-table/88730/1 "2024-04-12T09:28:00Z")

</div>

Hi everyone,

I have a table with Edit and Delete buttons. When you click the Delete button, a confirmation popup appears. If you click the OK button in the popup, it should delete the corresponding row from the table.

1. Delete Button Script: Add the following script to the actionPerformed event of the Delete button. This script will open the confirmation popup when the Delete button is clicked.  
 ![Screenshot (176)](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/9/1925be1904c239927e5c37f04fdd73e6ed6617ed.png)

I have to add the following script to the actionPerformed event of the OK button in the `Local_UNS/Delete_popup` view. This script will close the popup and delete the row from the table when the OK button is clicked.

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [April 12, 2024, 9:42am UTC](https://forum.inductiveautomation.com/t/delete-row-from-a-table/88730/2 "2024-04-12T09:42:13Z")

</div>

Don't script it on the popup's button.

Instead, make this button send a confirmation message with `system.perspective.sendMessage`.

Then, put a message handler on the table (right click -\> scripts).  
In this message handler, use the table's `props.selection` property to find which row you need to delete.

note: If the data comes from a database, I suggest you use a query to delete the row from the database table, then refresh the perspective table's data with `refreshBinding`.

note 2: With this method, you can use a generic confirmation popup. make it take a `popup_id` and `message_type` (and maybe the confirmation message you want to display in that popup) as parameters, then you can use those parameters to confirm/cancel whatever you want.
