How can I changing foreground colors from different column with configureCell on Power Table?

Hi there,

Correct me if Im wrong, I couldnt find similar example for this topic in forum.

I want to manage specific cells foreground colors reagarding to other cell value.

This is working for only zeroth column.

if (rowView % 2 == 0): 
	if (colView == 0 and value == 13):
		return {'foreground': 'white','background': self.Background_Colour}

This my example, please tell me whats wrong here?

if (rowView % 2 == 0): 
	if (colView == 0 and value == 13):
		if(colView == 1 or colView == 2 or colView == 4 or colView == 5 or colView == 6 or colView == 7 or colView == 8):
				return {'foreground': 'white','background': self.Background_Colour}

If colView = 0 and its value = 13, i want to manage foreground color of colView = (1,2,4,5,6), not colView=0

Thank in advance.

You need to understand how configureCell works.

It is invoked for each cell, every time the table needs to be redrawn.
Any logic involving other cells must be done by retrieving those cell values manually. You can’t tell another cell what color it should be; instead, when you are in a particular column, you must check the other cell(s) for your condition.

An additional point of caution: Do nothing expensive, such as a tag read or DB read, in configureCell, or you will ruin the responsiveness of your client. It’s safe to read from properties, and that’s about it.

2 Likes

Oh, I see.

Thank you for your reply.