# Table component :: How to select and hilight a row

**URL:** <https://forum.inductiveautomation.com/t/table-component-how-to-select-and-hilight-a-row/36166>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [June 29, 2020, 5:29pm UTC](https://forum.inductiveautomation.com/t/table-component-how-to-select-and-hilight-a-row/36166 "2020-06-29T17:29:43Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![beaudoin.stephane](https://avatars.discourse-cdn.com/v4/letter/b/8edcca/32.png) [@beaudoin.stephane](https://forum.inductiveautomation.com/u/beaudoin.stephane)\
**Post date:** [June 29, 2020, 5:29pm UTC](https://forum.inductiveautomation.com/t/table-component-how-to-select-and-hilight-a-row/36166/1 "2020-06-29T17:29:43Z")

</div>

Hi there,

I am using several table component in our project to list and select different items.  
I would like to select a row (by script) on the table … I tried to set the var: Selection.selectedRow = xyz but the item is not highlighting nor fire ‘onSelection’ change event.

is there a way to do that?

---

<div class="post-metadata">

**Author:** ![Tim](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tim/32/3361_2.png) [@Tim](https://forum.inductiveautomation.com/u/Tim)\
**Post date:** [June 29, 2020, 5:48pm UTC](https://forum.inductiveautomation.com/t/table-component-how-to-select-and-hilight-a-row/36166/2 "2020-06-29T17:48:22Z")

</div>

```
		event.source.getComponent('Table').selectedRow = 5

```

This would be an example script running from the root container which would do this.

---

<div class="post-metadata">

**Author:** ![beaudoin.stephane](https://avatars.discourse-cdn.com/v4/letter/b/8edcca/32.png) [@beaudoin.stephane](https://forum.inductiveautomation.com/u/beaudoin.stephane)\
**Post date:** [June 29, 2020, 8:29pm UTC](https://forum.inductiveautomation.com/t/table-component-how-to-select-and-hilight-a-row/36166/3 "2020-06-29T20:29:16Z")

</div>

Hi Tim. I think your answer is not working.  
first of all, thanks for your quick reply.

I’ve put your script ‘onStartup’ action on the view which has the table in it because I cannot figure out where to put your script a root within this view.

then, what is the prop ‘event’ and from where it comes from (context) ?.

lastly, I tried this (onStartup of the view): self.getRootContainer().getChild(‘Table’).selectedRow = 1  
got an error because selectedRow prop. doesn’t exists at all…

Sorry if I misunderstood something… I am a bit stuck

---

<div class="post-metadata">

**Author:** ![code\_skin](https://avatars.discourse-cdn.com/v4/letter/c/43a26b/32.png) [@code\_skin](https://forum.inductiveautomation.com/u/code_skin)\
**Post date:** [June 29, 2020, 8:35pm UTC](https://forum.inductiveautomation.com/t/table-component-how-to-select-and-hilight-a-row/36166/4 "2020-06-29T20:35:54Z")

</div>

Hi @beaudoin.stephane, @Tim has provided a Vision example while you’re looking for a perspective example. Is that correct?

---

<div class="post-metadata">

**Author:** ![Tim](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tim/32/3361_2.png) [@Tim](https://forum.inductiveautomation.com/u/Tim)\
**Post date:** [June 30, 2020, 4:13pm UTC](https://forum.inductiveautomation.com/t/table-component-how-to-select-and-hilight-a-row/36166/5 "2020-06-30T16:13:57Z")

</div>

Sorry, this example was for Vision. In Perspetive it would look like this. This example script was on a button onActionPerformed event.

`self.getSibling("Table").props.selection.selectedRow = 5`

---

<div class="post-metadata">

**Author:** ![valotaire.alexis](https://avatars.discourse-cdn.com/v4/letter/v/258eb7/32.png) [@valotaire.alexis](https://forum.inductiveautomation.com/u/valotaire.alexis)\
**Post date:** [June 30, 2020, 7:54pm UTC](https://forum.inductiveautomation.com/t/table-component-how-to-select-and-hilight-a-row/36166/6 "2020-06-30T19:54:03Z")

</div>

Hi, to have something selected in a table, you have to set the props “selectedRow” AND “selectedColumn” of the table to something or else both will be set to NULL.

---

<div class="post-metadata">

**Author:** ![beaudoin.stephane](https://avatars.discourse-cdn.com/v4/letter/b/8edcca/32.png) [@beaudoin.stephane](https://forum.inductiveautomation.com/u/beaudoin.stephane)\
**Post date:** [June 30, 2020, 7:59pm UTC](https://forum.inductiveautomation.com/t/table-component-how-to-select-and-hilight-a-row/36166/7 "2020-06-30T19:59:27Z")

</div>

Hi Tim, Yes the solution was for perspective.  
The Alexis’s answer is working well. Indeed we have to set also a column to make the selection working.  
Thanks for your reply.
