Hi guys, is there a way to trigger a change of cell color on cell edit? I know configure cell can provide the function, but i am a little uncertain if i can use it just at the moment of value change
EDIT: Sorry, posted before I was really finished.
Not quite an out of the box function.
I used a custom property on the table called ‘edited’. It’s the same size as data, but is filled with zeroes.
onCellEdited:
self.data = system.dataset.setValue(self.data, rowIndex, colIndex, newValue)
if oldValue != newValue:
self.edited = system.dataset.setValue(self.edited, rowIndex, colIndex, 1)
configureCell:
if selected:
if self.edited.getValueAt(rowIndex, colIndex) == 1:
return {'background': 'yellow', 'foreground': 'black'}
else:
return {'background': self.selectionBackground, 'foreground': self.selectionForeground}
elif self.edited.getValueAt(rowIndex, colIndex) == 1:
return {'background': 'yellow'}
else:
return {'background': 'white', 'foreground': 'black'}
A reset button to, well, reset it.
data = event.source.parent.getComponent('Power Table').data
headers = list(data.getColumnNames())
dataOut = [[0]*data.getColumnCount()]*data.getRowCount()
event.source.parent.getComponent('Power Table').edited = system.dataset.toDataSet(headers, dataOut)
event.source.parent.getComponent('Power Table').repaint()
event.source.parent.getComponent('Power Table').selectedRow = -1
Wow Jordan, thank you very much! The mirrored dataset to highlight if a value has changed is a lovely solution, this is exactly what i was looking for