# Vision Table Row Color

**URL:** <https://forum.inductiveautomation.com/t/vision-table-row-color/53356>\
**Category:** Ignition\
**Tags:** ignition80, vision\
**Created:** [November 22, 2021, 5:55pm UTC](https://forum.inductiveautomation.com/t/vision-table-row-color/53356 "2021-11-22T17:55:11Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![pkhoshroo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pkhoshroo/32/26801_2.png) [@pkhoshroo](https://forum.inductiveautomation.com/u/pkhoshroo)\
**Post date:** [November 22, 2021, 5:55pm UTC](https://forum.inductiveautomation.com/t/vision-table-row-color/53356/1 "2021-11-22T17:55:11Z")

</div>

Hello all,

I am trying to change the row color of my vision table based on the value of the individual cells in my table. So for example, if orderno is equal to my tag value I want that row to change the color.

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/8/d891bcbbf55cbff418cb4ba100047e55942c1866.png)

I wrote a cellEdited script on my table and I think this should work but it does not:

```auto
attributes = {"background": "#FFFFFF"}
data=event.source.data
if data.getValueAt(colIndex, 'orderno') == system.tag.read("[System]Client/orderno"):
	attributes["background"] ="#EEECE8"

```

---

<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:** [November 22, 2021, 6:00pm UTC](https://forum.inductiveautomation.com/t/vision-table-row-color/53356/2 "2021-11-22T18:00:13Z")

</div>

The cellEdited event has nothing to do with display. You need to perform this check in `configureCell`.

---

<div class="post-metadata">

**Author:** ![pkhoshroo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pkhoshroo/32/26801_2.png) [@pkhoshroo](https://forum.inductiveautomation.com/u/pkhoshroo)\
**Post date:** [November 22, 2021, 6:01pm UTC](https://forum.inductiveautomation.com/t/vision-table-row-color/53356/3 "2021-11-22T18:01:53Z")

</div>

You are correct! I totally forgot about that. However, I do not have the configure cell option here:

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/e/0e042ed8dd7b48e176d7ae2652bb75f758283488.png)

Probably I should switch to a power table. The code is not working in power table either

---

<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:** [November 22, 2021, 6:05pm UTC](https://forum.inductiveautomation.com/t/vision-table-row-color/53356/4 "2021-11-22T18:05:56Z")

</div>

Take a close look at the event header. Extension functions and custom methods supply `self` and some parameters, not `event`. So, no `event.source`.

---

<div class="post-metadata">

**Author:** ![pkhoshroo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pkhoshroo/32/26801_2.png) [@pkhoshroo](https://forum.inductiveautomation.com/u/pkhoshroo)\
**Post date:** [November 22, 2021, 6:07pm UTC](https://forum.inductiveautomation.com/t/vision-table-row-color/53356/5 "2021-11-22T18:07:49Z")

</div>

You are correct, Phil. Thank you so much for your help. Sometimes I completely forget about these differences.

---

<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:** [November 22, 2021, 6:11pm UTC](https://forum.inductiveautomation.com/t/vision-table-row-color/53356/6 "2021-11-22T18:11:02Z")

</div>

Consider doing as much as possible in project scripts, where you pass components and parameters to project functions. Either kind of event then becomes a one-liner (of different flavors) and you can maintain a single paradigm in the script library.

---

<div class="post-metadata">

**Author:** ![pkhoshroo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pkhoshroo/32/26801_2.png) [@pkhoshroo](https://forum.inductiveautomation.com/u/pkhoshroo)\
**Post date:** [November 22, 2021, 6:15pm UTC](https://forum.inductiveautomation.com/t/vision-table-row-color/53356/7 "2021-11-22T18:15:41Z")

</div>

I agree with you! Sometimes it is really difficult to maintain correct syntaxes as Ignition use multiple languages and sometimes it gets confusing.

---

<div class="post-metadata">

**Author:** ![pkhoshroo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pkhoshroo/32/26801_2.png) [@pkhoshroo](https://forum.inductiveautomation.com/u/pkhoshroo)\
**Post date:** [November 22, 2021, 6:50pm UTC](https://forum.inductiveautomation.com/t/vision-table-row-color/53356/8 "2021-11-22T18:50:54Z")

</div>

I have tried different scripts but none of them worked. This script should work but it does not. It always returns the color ‘yellow’ even though orderno is equal to my ordeno tag value.

```auto
	data = self.data.getValueAt(rowIndex,"orderno")
	if data == system.tag.readBlocking("[System]Client/orderno"):
		return{'background': 'red'}
	else: 
		return{'background': 'yellow'} 

```

---

<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:** [November 22, 2021, 6:54pm UTC](https://forum.inductiveautomation.com/t/vision-table-row-color/53356/9 "2021-11-22T18:54:01Z")

</div>

Under no circumstances should you ever do a tag read in a display-driven event. Bind that tag to custom property and use that in your event.

You can use a diagnostic print to show both values in the event.

---

<div class="post-metadata">

**Author:** ![pkhoshroo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pkhoshroo/32/26801_2.png) [@pkhoshroo](https://forum.inductiveautomation.com/u/pkhoshroo)\
**Post date:** [November 22, 2021, 7:06pm UTC](https://forum.inductiveautomation.com/t/vision-table-row-color/53356/10 "2021-11-22T19:06:54Z")

</div>

Thank you so much, Phil. It is working now. Appreciate your help.  
This is the final code:

```auto
	if self.orderno == self.data.getValueAt(rowIndex, "orderno"):
		return {'background': 'red'}
	else:
		return {'background': 'yellow'} 

```
