Table (not Power Table) and cell background color

Is there a way to change a cell's background color if the cell's value has changed, data type doesn't matter (string, numeric, boolean...)?

I could use a power table, but the issue is there's no easy way to highlight the current cell's value in a dropdown list.. This is a default feature in a Table. There's an extension function that will return a cell fore/background color but none to set it.

Figured it out, I used a global list of list to track the cell changed by saving a [row,col] list into a
Changetracking list in the cellEdited() event handler. In the getBackgroundAt() extension function create a list of the current cell location , Currcell = [row,col] and check if the list is in the Changetracking list, if so change it's color

Remember to define the "global" list in a project script and clear the "global" list in the screen's startup() event.

I would store a set on the local table using putClientProperty and getClientProperty - use a tuple (row, col) as the key. Sets are O(1) ~constant time lookup, where arrays or lists have to be scanned completely, meaning O(n) lookup (the time to retrieve a value gets longer the more items there are in the list).

1 Like

I recommend creating a custom dataset property to hold the unmodified table, and move the original data binding to it. Then unidirectionally bind data to the custom property. This yields the same editing behavior you now have, but you won't have to maintain a change list. Just compare the supplied value to the corresponding entry in the unmodified dataset, using the row and column given. Dataset.getValueAt() is also O(1). This approach has the nice side-effect that re-editing a cell back to it original will remove its highlight.

4 Likes