# How to scroll to the highlighed row of the table

**URL:** <https://forum.inductiveautomation.com/t/how-to-scroll-to-the-highlighed-row-of-the-table/54039>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [December 13, 2021, 11:10am UTC](https://forum.inductiveautomation.com/t/how-to-scroll-to-the-highlighed-row-of-the-table/54039 "2021-12-13T11:10:25Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![manjuyadav95.m](https://avatars.discourse-cdn.com/v4/letter/m/9fc348/32.png) [@manjuyadav95.m](https://forum.inductiveautomation.com/u/manjuyadav95.m)\
**Post date:** [December 13, 2021, 11:10am UTC](https://forum.inductiveautomation.com/t/how-to-scroll-to-the-highlighed-row-of-the-table/54039/1 "2021-12-13T11:10:25Z")

</div>

@cmallonee @victordcq I referred to this below link and the given solution worked out but to see the highlighted row in the table sometimes I need to check by scrolling down ..how can I make it top of the list or auto-scroll down to view the highlighted row..?

> [@Changing colour of row based off value in cell in perspective table](https://forum.inductiveautomation.com/t/changing-colour-of-row-based-off-value-in-cell-in-perspective-table/43587):
>
> Hi, I just want to change the colour of the rows in my table based off the values on one of the cells. I am unsure on how to go about this in perspective, any help is welcome.

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [December 13, 2021, 12:00pm UTC](https://forum.inductiveautomation.com/t/how-to-scroll-to-the-highlighed-row-of-the-table/54039/2 "2021-12-13T12:00:36Z")

</div>

You would have to move the row it to index 0 i suppose

instead of appending the array use array.insert(0,data)

```auto
if ??:
  returned_rows.insert(0,row_dict)
else:
 returned_rows.append(row_dict)

```

---

<div class="post-metadata">

**Author:** ![manjuyadav95.m](https://avatars.discourse-cdn.com/v4/letter/m/9fc348/32.png) [@manjuyadav95.m](https://forum.inductiveautomation.com/u/manjuyadav95.m)\
**Post date:** [December 13, 2021, 12:14pm UTC](https://forum.inductiveautomation.com/t/how-to-scroll-to-the-highlighed-row-of-the-table/54039/3 "2021-12-13T12:14:24Z")

</div>

This one worked out but auto-scroll to show the highlighted row will be the best one as if scrolled down and searched then the highlighted row shows on top…Auto scroll to show the highlighted row is possible?

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [December 13, 2021, 1:22pm UTC](https://forum.inductiveautomation.com/t/how-to-scroll-to-the-highlighed-row-of-the-table/54039/4 "2021-12-13T13:22:45Z")

</div>

No sadly its not really possible without javascript.

---

<div class="post-metadata">

**Author:** ![manjuyadav95.m](https://avatars.discourse-cdn.com/v4/letter/m/9fc348/32.png) [@manjuyadav95.m](https://forum.inductiveautomation.com/u/manjuyadav95.m)\
**Post date:** [December 13, 2021, 1:26pm UTC](https://forum.inductiveautomation.com/t/how-to-scroll-to-the-highlighed-row-of-the-table/54039/5 "2021-12-13T13:26:11Z")

</div>

ok fine. Thanks a lot for your help 🙂 👍

---

<div class="post-metadata">

**Author:** ![manjuyadav95.m](https://avatars.discourse-cdn.com/v4/letter/m/9fc348/32.png) [@manjuyadav95.m](https://forum.inductiveautomation.com/u/manjuyadav95.m)\
**Post date:** [December 13, 2021, 2:02pm UTC](https://forum.inductiveautomation.com/t/how-to-scroll-to-the-highlighed-row-of-the-table/54039/6 "2021-12-13T14:02:34Z")

</div>

by following this step to highlight the row…the dataset got converted into an array of data as below:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/b/abd00a20c63d25167c7d53fb1fa2b4cba0f0f10b.png)

and onRowClick event , I am using below code  
`value=self.props.data.getValueAt(self.props.selection.selectedRow, 'Id') system.perspective.print(value) `  
I am getting an error:

```auto
object has no attribute 'getValueAt'

```

how to get the selectedrow in case of data array…pls help @victordcq

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [December 13, 2021, 2:11pm UTC](https://forum.inductiveautomation.com/t/how-to-scroll-to-the-highlighed-row-of-the-table/54039/7 "2021-12-13T14:11:56Z")

</div>

> [@manjuyadav95.m](#):
>
> value=self.props.data.getValueAt(self.props.selection.selectedRow, 'Id')

try  
`value=self.props.data[self.props.selection.selectedRow]['Id']`  
or  
`value=self.props.data[self.props.selection.selectedRow].Id`

---

<div class="post-metadata">

**Author:** ![manjuyadav95.m](https://avatars.discourse-cdn.com/v4/letter/m/9fc348/32.png) [@manjuyadav95.m](https://forum.inductiveautomation.com/u/manjuyadav95.m)\
**Post date:** [December 14, 2021, 5:14am UTC](https://forum.inductiveautomation.com/t/how-to-scroll-to-the-highlighed-row-of-the-table/54039/8 "2021-12-14T05:14:44Z")

</div>

> [@victordcq](#):
>
> self.props.data[self.props.selection.selectedRow].Id

Thanks a lot 👍 👍

---

<div class="post-metadata">

**Author:** ![manjuyadav95.m](https://avatars.discourse-cdn.com/v4/letter/m/9fc348/32.png) [@manjuyadav95.m](https://forum.inductiveautomation.com/u/manjuyadav95.m)\
**Post date:** [December 14, 2021, 10:12am UTC](https://forum.inductiveautomation.com/t/how-to-scroll-to-the-highlighed-row-of-the-table/54039/9 "2021-12-14T10:12:07Z")

</div>

@victordcq @cmallonee@pascal.fragnoud ...I am getting output in the console as object wrapper as below while clicking on Row and only for highlighted row ...for an unhighlighted row, I am getting proper output means the only value of ID as 101...I want the same output for highlighted one also, how to achieve that?

```auto
<ObjectWrapper>: {u'style': {u'backgroundColor': u'#AAAAAA'}, u'value': u'101'}

```

using value, at last, I got proper output for a highlighted row but for an unhighlighted row, it's throwing below error

```auto
value=self.props.data[self.props.selection.selectedRow]['Id'].value

error........
unicode' object has no attribute 'value'

```

by clicking on a row, I need proper value for both highlighted and unhighlighted rows..plz help

Solved it ...Thanks!!

to highlight the row, I followed as given in this below link...

> [@Changing colour of row based off value in cell in perspective table](https://forum.inductiveautomation.com/t/changing-colour-of-row-based-off-value-in-cell-in-perspective-table/43587):
>
> Hi, I just want to change the colour of the rows in my table based off the values on one of the cells. I am unsure on how to go about this in perspective, any help is welcome.

Here, in below code I edited from ..

```auto
if str(row['Id'])== IdTxt:
			row_dict['Id] = {'value': row['Id'], 'style': {'backgroundColor': backgroundColor}}
			returned_rows.insert(0,row_dict)
			self.props.selection.selectedRow=-1
		else:
			row_dict['Id'] = row['Id']
                        returned_rows.append(row_dict)

```

To ..Final code

```auto
if str(row['Id'])==IdTxt:
			row_dict['Id'] = {'value': row['Id'], 'style': {'backgroundColor': backgroundColor}}
			returned_rows.insert(0,row_dict)
			self.props.selection.selectedRow=-1
		else:
			row_dict['Id'] = {'value': row['Id']}
                        returned_rows.append(row_dict)

```

Just added value in else condition that worked out for me and now getting proper ID value on both highlighted and unhighlighted rows..Hope this helps.

Thank you!

---

<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:** [December 14, 2021, 2:53pm UTC](https://forum.inductiveautomation.com/t/how-to-scroll-to-the-highlighed-row-of-the-table/54039/10 "2021-12-14T14:53:51Z")

</div>

Don’t delete your posts when you find the solution, instead explain what you did to solve your issue.  
It might help other people who have the same problem.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [December 14, 2021, 6:02pm UTC](https://forum.inductiveautomation.com/t/how-to-scroll-to-the-highlighed-row-of-the-table/54039/11 "2021-12-14T18:02:37Z")

</div>

> **[Wisdom of the Ancients](https://xkcd.com/979/)**
>
> All long help threads should have a sticky globally-editable post at the top saying 'DEAR PEOPLE FROM THE FUTURE: Here's what we've figured out so far ...'

---

<div class="post-metadata">

**Author:** ![manjuyadav95.m](https://avatars.discourse-cdn.com/v4/letter/m/9fc348/32.png) [@manjuyadav95.m](https://forum.inductiveautomation.com/u/manjuyadav95.m)\
**Post date:** [December 15, 2021, 10:23am UTC](https://forum.inductiveautomation.com/t/how-to-scroll-to-the-highlighed-row-of-the-table/54039/12 "2021-12-15T10:23:24Z")

</div>

the table row will get highlighted based on text in the text field but it is case sensitive unlike filter table search …is there any solution for this? @victordcq

It’s awkward to type ID in caps and search so plz help

---

<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:** [December 15, 2021, 10:36am UTC](https://forum.inductiveautomation.com/t/how-to-scroll-to-the-highlighed-row-of-the-table/54039/13 "2021-12-15T10:36:43Z")

</div>

Use `'some_string'.lower()` everywhere you’re comparing strings.

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [December 15, 2021, 12:13pm UTC](https://forum.inductiveautomation.com/t/how-to-scroll-to-the-highlighed-row-of-the-table/54039/14 "2021-12-15T12:13:49Z")

</div>

If you use weird characters, though you might first want to do an upper too

```auto
"ß".lower() == "SS".lower()
#>>> false
"ß".upper().lower() == "SS".upper().lower()
#>>> true

```

---

<div class="post-metadata">

**Author:** ![manjuyadav95.m](https://avatars.discourse-cdn.com/v4/letter/m/9fc348/32.png) [@manjuyadav95.m](https://forum.inductiveautomation.com/u/manjuyadav95.m)\
**Post date:** [December 15, 2021, 12:13pm UTC](https://forum.inductiveautomation.com/t/how-to-scroll-to-the-highlighed-row-of-the-table/54039/15 "2021-12-15T12:13:50Z")

</div>

Thank u 👍

---

<div class="post-metadata">

**Author:** ![manjuyadav95.m](https://avatars.discourse-cdn.com/v4/letter/m/9fc348/32.png) [@manjuyadav95.m](https://forum.inductiveautomation.com/u/manjuyadav95.m)\
**Post date:** [December 15, 2021, 12:24pm UTC](https://forum.inductiveautomation.com/t/how-to-scroll-to-the-highlighed-row-of-the-table/54039/16 "2021-12-15T12:24:56Z")

</div>

Thank u 👍

---

<div class="post-metadata">

**Author:** ![manjuyadav95.m](https://avatars.discourse-cdn.com/v4/letter/m/9fc348/32.png) [@manjuyadav95.m](https://forum.inductiveautomation.com/u/manjuyadav95.m)\
**Post date:** [December 15, 2021, 12:33pm UTC](https://forum.inductiveautomation.com/t/how-to-scroll-to-the-highlighed-row-of-the-table/54039/17 "2021-12-15T12:33:22Z")

</div>

ignition doesn’t support javascript for auto scroll to show the highlighted row?

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [December 15, 2021, 12:35pm UTC](https://forum.inductiveautomation.com/t/how-to-scroll-to-the-highlighed-row-of-the-table/54039/18 "2021-12-15T12:35:29Z")

</div>

Only if you make your own component, you have acces to javascript.  
In the designer there is only jython (java+python)

…

What you maybe can try tho (but idk if it will work is) is give every row an extra column with an embedded view and in that view trigger a self.focus() on something. (based on the condition)

self.focus() should also cause a scroll to happen, atleast it does in the view idk if it also will do that in a table. But i think it should work

---

<div class="post-metadata">

**Author:** ![manjuyadav95.m](https://avatars.discourse-cdn.com/v4/letter/m/9fc348/32.png) [@manjuyadav95.m](https://forum.inductiveautomation.com/u/manjuyadav95.m)\
**Post date:** [December 15, 2021, 1:26pm UTC](https://forum.inductiveautomation.com/t/how-to-scroll-to-the-highlighed-row-of-the-table/54039/19 "2021-12-15T13:26:01Z")

</div>

I tried this way …but not sure that followed as per your reply…below the steps which I tried…

1. checkbox view created then added one more col and changed render as view and selected viewpath as “checkbox view”.
2. checkbox view \>scripts\>message handler\>below focus code written…  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/1/2165b8e6913ad13c2df09760460f2dedad3e5a15.png)
3. Added the below sendMessage line in add transform …

```auto
if str(row['Id'].lower())== IdTxt:
			row_dict['Id'] = {'value': row['Id'], 'style': {'backgroundColor': backgroundColor}}
			system.perspective.sendMessage("RowFocus")
else:
			row_dict['Id'] = {'value': row['Id']}
returned_rows.append(row_dict)

```

This trial not worked …I understood wrongly ? plz clarify and help

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [December 15, 2021, 1:32pm UTC](https://forum.inductiveautomation.com/t/how-to-scroll-to-the-highlighed-row-of-the-table/54039/20 "2021-12-15T13:32:20Z")

</div>

Yeah it wont work like this while you are making the columns still, becuase the rows havent been made yet. Dont work with messages for this one as they might get send and not recieved if the row isnt loaded yet.

I suggest you pass the params row[‘Id’] and IdTxt to the view and there, on a custom prop expression struct bound to these values, check if they match.  
you might alse have to put a delay in before doing the focus… just to be sure

**And turn off virtualized rows prop**

[Next page](https://forum.inductiveautomation.com/t/how-to-scroll-to-the-highlighed-row-of-the-table/54039.md?page=2)
