# Icon functionality in perspective table

**URL:** <https://forum.inductiveautomation.com/t/icon-functionality-in-perspective-table/82826>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [December 7, 2023, 7:44am UTC](https://forum.inductiveautomation.com/t/icon-functionality-in-perspective-table/82826 "2023-12-07T07:44:46Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mohd\_Waqas](https://avatars.discourse-cdn.com/v4/letter/m/f9ae1b/32.png) [@Mohd\_Waqas](https://forum.inductiveautomation.com/u/Mohd_Waqas)\
**Post date:** [December 7, 2023, 7:44am UTC](https://forum.inductiveautomation.com/t/icon-functionality-in-perspective-table/82826/1 "2023-12-07T07:44:46Z")

</div>

we have edit icon column in a table ,I want to do functionality on table row like when we click the edit icon the particula row data will be editable. and for remove it will remove the particular row data

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [December 11, 2023, 4:26pm UTC](https://forum.inductiveautomation.com/t/icon-functionality-in-perspective-table/82826/2 "2023-12-11T16:26:45Z")

</div>

Removing should be easy, but _editing_ might not be possible because I don't think there's a way to tell the Table to enter editing mode via scripting.

Removal will require a few things (this assumes a data structure which is a list of dictionaries - DataSets will need to modify the Message Handler Script slightly):

1. The View which contains your "delete" icon accept a `param` with a key of `rowIndex`.
2. The Table have a configured Message Handler with a name of your choosing; my later script will use a name of "DELETE\_ROW".
3. The `onClick` Event of the Icon should have a Script Action configured to invoke the Message Handler.

`onClick` Event Script Action:

```auto
system.perspective.sendMessage("DELETE_ROW", payload={"rowIndex": self.view.params.rowIndex, scope="page"}

```

Table Message Handler Script:

```auto
del self.props.data[payload["rowIndex"]]

```

---

<div class="post-metadata">

**Author:** ![Mohd\_Waqas](https://avatars.discourse-cdn.com/v4/letter/m/f9ae1b/32.png) [@Mohd\_Waqas](https://forum.inductiveautomation.com/u/Mohd_Waqas)\
**Post date:** [December 12, 2023, 10:46am UTC](https://forum.inductiveautomation.com/t/icon-functionality-in-perspective-table/82826/3 "2023-12-12T10:46:18Z")

</div>

> [@cmallonee](#):
>
> `del self.props.data[payload["rowIndex"]]`

on click event script - having some missing term .... or some error mismatching type on Scope = page

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [December 12, 2023, 3:33pm UTC](https://forum.inductiveautomation.com/t/icon-functionality-in-perspective-table/82826/4 "2023-12-12T15:33:20Z")

</div>

~~Please supply the exact error message.~~

```auto
# never assume my code is golden - this is all just me typing into the forums
system.perspective.sendMessage("DELETE_ROW", payload={"rowIndex": self.view.params.rowIndex}, scope="page")

```

---

<div class="post-metadata">

**Author:** ![Mohd\_Waqas](https://avatars.discourse-cdn.com/v4/letter/m/f9ae1b/32.png) [@Mohd\_Waqas](https://forum.inductiveautomation.com/u/Mohd_Waqas)\
**Post date:** [December 13, 2023, 7:21am UTC](https://forum.inductiveautomation.com/t/icon-functionality-in-perspective-table/82826/5 "2023-12-13T07:21:24Z")

</div>

can you elaborate the point 1 - View which contains your "delete" icon accept a `param` with a key of `rowIndex` ?

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [December 13, 2023, 3:33pm UTC](https://forum.inductiveautomation.com/t/icon-functionality-in-perspective-table/82826/6 "2023-12-13T15:33:17Z")

</div>

In the View which will contain your Icons, select the named View node (not the `root` node) in the Project Browser. Now, in the Property Editor, add a new property into the `PARAMS` category. Rename the key of this property to `rowIndex` (case-sensitive). This View will now accept a parameter of `rowIndex` from any source which uses this View. I recommend a default value of empty string for your use case.

To use this View within the Table, you need to must configure the `render` prop of the column configuration to be "view", and you must then configure the `viewPath` prop of the column configuration to be the path of the View you just made which contains your Icons.
