# Deselect and Un-Highlight Table Row

**URL:** <https://forum.inductiveautomation.com/t/deselect-and-un-highlight-table-row/79014>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [September 12, 2023, 1:40pm UTC](https://forum.inductiveautomation.com/t/deselect-and-un-highlight-table-row/79014 "2023-09-12T13:40:47Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Liam\_Dietrich](https://avatars.discourse-cdn.com/v4/letter/l/b5a626/32.png) [@Liam\_Dietrich](https://forum.inductiveautomation.com/u/Liam_Dietrich)\
**Post date:** [September 12, 2023, 1:40pm UTC](https://forum.inductiveautomation.com/t/deselect-and-un-highlight-table-row/79014/1 "2023-09-12T13:40:47Z")

</div>

**Issue:** Perspective table row remains highlighted after `selectedRow` property is set to `None`.  
**Goal:** Using script, deselect and un-highlight the row of a table component.

**More info:** I am attempting to deselect the row of the table component. I have successfully deselected the row using `...props.selection.selectedRow = None`. Yet the row remains highlighted. Any suggestions to un-highlight the row would be greatly appreciated.

**Note:** The table that I am working with has two columns, but only one is shown.

**Images:**  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/a/0a6b8e988b0ec098a1f69afc3490b70b29aca2dd.png)

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [September 12, 2023, 1:51pm UTC](https://forum.inductiveautomation.com/t/deselect-and-un-highlight-table-row/79014/2 "2023-09-12T13:51:29Z")

</div>

You have to set both `selectedRow` and `selectedColumn` to `None`.

> [@Table clearing error](https://forum.inductiveautomation.com/t/table-clearing-error/64027/15):
>
> At the moment, if you need to clear selection, just set both the selectedColumn and selectedRow properties to None or null. Currently, the selection data is intended to be read only. It looks like by clearing it, we might be interfering with some internal book keeping of selection data. We will look into it, but for now all you need to do is set selectedColumn and selectedRow to null, and the Table will clear the selected data for you.

---

<div class="post-metadata">

**Author:** ![Liam\_Dietrich](https://avatars.discourse-cdn.com/v4/letter/l/b5a626/32.png) [@Liam\_Dietrich](https://forum.inductiveautomation.com/u/Liam_Dietrich)\
**Post date:** [September 12, 2023, 1:53pm UTC](https://forum.inductiveautomation.com/t/deselect-and-un-highlight-table-row/79014/3 "2023-09-12T13:53:54Z")

</div>

Thank you for the response. Unfortunately I have already attempted setting both `selectedRow` and `selectedColumn` to `None` and it did not solve my issue.

---

<div class="post-metadata">

**Author:** ![Liam\_Dietrich](https://avatars.discourse-cdn.com/v4/letter/l/b5a626/32.png) [@Liam\_Dietrich](https://forum.inductiveautomation.com/u/Liam_Dietrich)\
**Post date:** [September 12, 2023, 2:04pm UTC](https://forum.inductiveautomation.com/t/deselect-and-un-highlight-table-row/79014/4 "2023-09-12T14:04:24Z")

</div>

I was able to find a work around. If the selectedRow and selectedColumn are set to `-1`, the row is unhighlighted. Then the selectedRow and selectedColumn can be set to `None`.

```auto
self.props.selection.selectedRow = -1
self.props.selection.selectedColumn = -1
self.props.selection.selectedRow = None
self.props.selection.selectedColumn = None

```

---

<div class="post-metadata">

**Author:** ![jacob\_geers](https://avatars.discourse-cdn.com/v4/letter/j/4da419/32.png) [@jacob\_geers](https://forum.inductiveautomation.com/u/jacob_geers)\
**Post date:** [April 10, 2025, 6:17pm UTC](https://forum.inductiveautomation.com/t/deselect-and-un-highlight-table-row/79014/5 "2025-04-10T18:17:58Z")

</div>

Thanks, FYI to others, do not also do `selection.data = []` as it will cause the whole thing to not work.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [April 10, 2025, 6:26pm UTC](https://forum.inductiveautomation.com/t/deselect-and-un-highlight-table-row/79014/6 "2025-04-10T18:26:21Z")

</div>

The most reliable way I've found to do this is to **disable** row selection, let that bounce over to the browser, which will then clear `props.selection.data`. A change event on `props.selection.data` can then re-enable row selection when it sees the new empty value.

In general, properties that are set via user interaction in the browser, like selections, need to also be _unset_ by the browser. Unsetting them directly via script (which runs in the gateway, not the browser) is unreliable.

---

<div class="post-metadata">

**Author:** ![Ryan\_Deardorff](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan_deardorff/32/63815_2.png) [@Ryan\_Deardorff](https://forum.inductiveautomation.com/u/Ryan_Deardorff)\
**Post date:** [April 10, 2025, 7:03pm UTC](https://forum.inductiveautomation.com/t/deselect-and-un-highlight-table-row/79014/7 "2025-04-10T19:03:45Z")

</div>

I've been using a library function I created for this purpose. I could be mistaken but I think @pturmel has indicated that Timers aren't totally reliable, but they've always seemed to work well for my purposes.

```python
from threading import Timer

def reenableSelect(table):
	table.props.selection.enableRowSelection = True 
		
def deselectRow(table):
	table.props.selection.selectedRow = None
	table.props.selection.enableRowSelection = False
	Timer(0.2, reenableSelect, [table]).start()

```

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [April 10, 2025, 7:37pm UTC](https://forum.inductiveautomation.com/t/deselect-and-un-highlight-table-row/79014/8 "2025-04-10T19:37:03Z")

</div>

No need for a timer if you follow my pseudocode. And a timer doesn't ensure that the traffic made the round trip to the browser. (Do note that you should **not** blindly disable row selection--only do so when there is a non-empty selection that you wish to eliminate.)

---

<div class="post-metadata">

**Author:** ![Cameronin](https://avatars.discourse-cdn.com/v4/letter/c/9fc29f/32.png) [@Cameronin](https://forum.inductiveautomation.com/u/Cameronin)\
**Post date:** [April 28, 2025, 12:03pm UTC](https://forum.inductiveautomation.com/t/deselect-and-un-highlight-table-row/79014/9 "2025-04-28T12:03:04Z")

</div>

Hi Phil

I'm trying to do this deselect a row thing.  
Are you putting this on a row-click event or on a 'clear selection' button?  
If it's on the row-click (which I'd prefer, so that's what I'm attempting), what are you using as parameters to trigger disabling row selection such that it only happens if the row is currently highlighted?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [April 28, 2025, 4:27pm UTC](https://forum.inductiveautomation.com/t/deselect-and-un-highlight-table-row/79014/10 "2025-04-28T16:27:00Z")

</div>

Either separate button or row ctrl-click.

For both cases, only disable row selection if there is a currently selected row. Otherwise do nothing.

---

<div class="post-metadata">

**Author:** ![msteele](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/msteele/32/77889_2.png) [@msteele](https://forum.inductiveautomation.com/u/msteele)\
**Post date:** [April 28, 2025, 6:36pm UTC](https://forum.inductiveautomation.com/t/deselect-and-un-highlight-table-row/79014/11 "2025-04-28T18:36:33Z")

</div>

Here's how I do a button to de-select row(s):

- Button with script onActionPerformed:  
`self.[relPathToTable].props.selection.enableRowSelection = False`  
Button.enabled has expression binding `!isNull({[relPathToTable].props.selection.selectedRow})`

- Table.selection.selectedRow has a change script.  
`if currentValue.value is None:`  
`self.props.selection.enableRowSelection = True`

Button disables row selection. This nulls table.data.selectedRow. Upon that, change script re-enables table.selection.enableRowSelection so rows can be selected again.

Wonky in how it works, but clean user experience. Thanks to @pturmel for this tip.

---

<div class="post-metadata">

**Author:** ![Noah\_Gilgo](https://avatars.discourse-cdn.com/v4/letter/n/c89c15/32.png) [@Noah\_Gilgo](https://forum.inductiveautomation.com/u/Noah_Gilgo)\
**Post date:** [October 14, 2025, 5:14pm UTC](https://forum.inductiveautomation.com/t/deselect-and-un-highlight-table-row/79014/12 "2025-10-14T17:14:24Z")

</div>

My implementation of this solution is not consistent.

For me, it can take anywhere between 1-10 instances of setting `enableRowSelection` to False then true in the manner you described before the selected row actually clears on the front end.

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [October 14, 2025, 5:39pm UTC](https://forum.inductiveautomation.com/t/deselect-and-un-highlight-table-row/79014/13 "2025-10-14T17:39:58Z")

</div>

I’ve always done it by setting _ **both** _ selectedRow and selectedColumn to None.

---

<div class="post-metadata">

**Author:** ![Noah\_Gilgo](https://avatars.discourse-cdn.com/v4/letter/n/c89c15/32.png) [@Noah\_Gilgo](https://forum.inductiveautomation.com/u/Noah_Gilgo)\
**Post date:** [October 14, 2025, 5:47pm UTC](https://forum.inductiveautomation.com/t/deselect-and-un-highlight-table-row/79014/14 "2025-10-14T17:47:15Z")

</div>

Setting both to null still does not deliver consistent results for me.

---

<div class="post-metadata">

**Author:** ![Noah\_Gilgo](https://avatars.discourse-cdn.com/v4/letter/n/c89c15/32.png) [@Noah\_Gilgo](https://forum.inductiveautomation.com/u/Noah_Gilgo)\
**Post date:** [October 14, 2025, 5:57pm UTC](https://forum.inductiveautomation.com/t/deselect-and-un-highlight-table-row/79014/15 "2025-10-14T17:57:25Z")

</div>

UPDATE: Nevermind, I see what you were talking about. I originally was setting `selectedRow` and `selectedColumn` to `None` in the change script on `props.selection.data`. When I moved the logic for setting both values to `None` to the first step, it worked properly.
