Power Table Colours

I’m trying to configure cell color in ConfigureCell function and it is giving me some little unusual result.

The script looks like :

	if selected:
		return {'background': self.selectionBackground}
	elif rowView % 2 == 0 and '*' in textValue:
		return {'background': 'white', 'foreground': 'red', 'text':textValue.strip('*')}
	elif rowView % 2 == 0:
		return {'background': 'white'}
	elif rowView % 2 != 0 and '*' in textValue:
		return {'background': '#DDDDDD', 'foreground': 'red', 'text':textValue.strip('*')}
	else :
		return {'background': '#DDDDDD'}
		

but it gives white background wherever there is blank cell :

Thanks

For clarity, and to avoid duplication, I’d suggest splitting up your conditions:

	config = {}
	if selected:
		config['background'] = self.selectionBackground
	elif rowView % 2 == 0 
		config['background'] = 'white'
	else:
		config['background'] = '#DDDDDD'

	if '*' in textValue:
		config['foreground'] = 'red'
		config['text'] = textValue.strip('*')
	
	return config
3 Likes

I did. But still the same error !