How to update Vision Table row background color

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.

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 ?

Thanks
Sharad

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

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.

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'}

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

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

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'}
1 Like

Thank You. It works great !!