Hello,
Similar to this thread where I am trying to figure out what actually triggers the execution of the Power Table configureCell function.
I have a table with a "State" column, where i want to by default the background color to white (or nothing) if the cell value is "OK" for that column.
If the value is anything other than "OK", i want to provide a colored background to highlight an issue.
# Convert rework state number to text.
# To keep it simple, leave 0 (no changes) as "OK"
# and anything > 0 (some change made) as "REWORK"
# Note: White background = '#FFFFFF'
# Set initial style to white background.
# Any changes based on other logic after that can be modified / added using standard dictionary access.
# ie: rowStyle['stylePropName'] = value
rowStyle = {'background':'#FFFFFF'}
if rowIndex == 29:
# Highlight row 0 grey to indicate it is not changeable
rowStyle['background'] = '#D5D5D5'
# end if
# Update State column text to translate code into something useful for PTs
if colIndex == 1:
if value > 0:
rowStyle['text'] = 'REWORK'
rowStyle['background'] = self.rowColor_warn
elif value == 0:
rowStyle['text'] = 'OK'
else:
rowStyle['text'] = 'INVALID'
rowStyle['background'] = self.rowColor_error
# end if
return rowStyle
This is all working fine but i then discovered things get a bit weird when you try and select a row that has a custom style background. Ideally i wanted the in-build row selection style to be applied in that case, so i added the following code at the end of my script to deal to it, which also works fine.
if rowIndex == self.selectedRow:
del rowStyle['background']
# end if
return rowStyle
However the crux of my problem is the multi-row selection. This doesn't seem to be in sync with the configureCell updates.
Selected rows 0, 2, 5:
But the last row to be selected, index 5, hasn't refreshed the configureCell script to remove the white background. And won't do so until the next row is selected.