# How to update Vision Table row background color

**URL:** <https://forum.inductiveautomation.com/t/how-to-update-vision-table-row-background-color/97833>\
**Category:** Ignition\
**Tags:** ignition81, vision, scripting\
**Created:** [October 28, 2024, 2:35pm UTC](https://forum.inductiveautomation.com/t/how-to-update-vision-table-row-background-color/97833 "2024-10-28T14:35:27Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![sharad.sharma](https://avatars.discourse-cdn.com/v4/letter/s/439d5e/32.png) [@sharad.sharma](https://forum.inductiveautomation.com/u/sharad.sharma)\
**Post date:** [October 28, 2024, 2:35pm UTC](https://forum.inductiveautomation.com/t/how-to-update-vision-table-row-background-color/97833/1 "2024-10-28T14:35:27Z")

</div>

I am trying to update the vision table row background color only, when the logon user is same as the Assigned user column value.  
I have added the below script to the propertyChange event on the Table.

```python
logonUser = system.security.getUsername()
tbl = event.source.data
from java.awt import Color
for row in range(tbl.rowCount):
	taskUser = (tbl.data)[2][row]
	if taskUser == logonUser:
		event.source.background = Color(255,0,0)

```

It updates the full table background color of the table if the logon user is same as the assigned user. Is there a way to refer the col index or row index when calling the event.source.background function ?

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

Thanks  
Sharad

---

<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:** [October 28, 2024, 3:11pm UTC](https://forum.inductiveautomation.com/t/how-to-update-vision-table-row-background-color/97833/2 "2024-10-28T15:11:49Z")

</div>

Switch to a Power Table and use the `configureCell` function, which will be called automatically once per visible cell of your table.

---

<div class="post-metadata">

**Author:** ![sharad.sharma](https://avatars.discourse-cdn.com/v4/letter/s/439d5e/32.png) [@sharad.sharma](https://forum.inductiveautomation.com/u/sharad.sharma)\
**Post date:** [October 28, 2024, 4:30pm UTC](https://forum.inductiveautomation.com/t/how-to-update-vision-table-row-background-color/97833/3 "2024-10-28T16:30:05Z")

</div>

Thank You Paul for the guidance. I was able to use the configureCell Event on the Power Table to update the cell back ground color when the Assigned user is same as the Logon user.  
Below is the code.

```python
def configureCell(self, value, textValue, selected, rowIndex, colIndex, colName, rowView, colView):
# This example adds alternating background color:
#	if selected:
# return {'background': self.selectionBackground}
#	elif rowView % 2 == 0:
# return {'background': 'white'}
#	else:
# return {'background': '#DDDDDD'}
	logonUser = system.security.getUsername()
	if value == logonUser:
		return {'background': 'yellow', 'foreground': 'black'}

```

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/6/c6c0a407227f900f5604911b7aa92466bda5eb1c.png)

I am wondering how easy it I would be to update the background for the full row, for this same condition.  
Thanks  
Sharad

---

<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:** [October 28, 2024, 4:49pm UTC](https://forum.inductiveautomation.com/t/how-to-update-vision-table-row-background-color/97833/4 "2024-10-28T16:49:22Z")

</div>

Instead of comparing against `value`, use the `rowIndex` parameter to retrieve the appropriate value from the 'Assigned User' column, e.g.

```python
def configureCell(self, value, textValue, selected, rowIndex, colIndex, colName, rowView, colView):
	logonUser = system.security.getUsername()
	if self.data.getValueAt(rowIndex, "Assigned User") == logonUser:
		return {'background': 'yellow', 'foreground': 'black'}

```

---

<div class="post-metadata">

**Author:** ![sharad.sharma](https://avatars.discourse-cdn.com/v4/letter/s/439d5e/32.png) [@sharad.sharma](https://forum.inductiveautomation.com/u/sharad.sharma)\
**Post date:** [October 28, 2024, 5:28pm UTC](https://forum.inductiveautomation.com/t/how-to-update-vision-table-row-background-color/97833/5 "2024-10-28T17:28:45Z")

</div>

Thank You. It works great !!

---

<div class="post-metadata">

**Author:** ![Paolo.Mariani](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paolo.mariani/32/3285_2.png) [@Paolo.Mariani](https://forum.inductiveautomation.com/u/Paolo.Mariani)\
**Post date:** [November 5, 2024, 8:15pm UTC](https://forum.inductiveautomation.com/t/how-to-update-vision-table-row-background-color/97833/6 "2024-11-05T20:15:37Z")

</div>

Closed on November 5, 2024, 8:15pm UTC


