I have a report screen with hundreds of formatted text fields bound to tag values, each with several target properties that determine if it should be colored red, green, etc.
I created a power table to make setting the target properties more user friendly. Is it possible to have the cell update binding of the underlying dataset be bidirectional, such that when I type into the table, the bound property is updated?
Alternatively, is there a good way to mimic this behavior in the onCellEdited function of the power table, so that I can grab the cell binding at the edited row and column and update its value via scripting?
1 Like
Edit: Interesting question. None of my ideas feel very maintainable, but I was contemplating this, and consequently, I had it open in a tab when I was answering another question. I inadvertently posted my answer to that question here.
...even though I don't have the correct answer to this question, at least this post gets a bump back to the top.
I messed around with various ways to do this, and the simplest thing I found that worked was to add a dataset custom property to the table called tagSources
. Then row for row, column for column, store the tag paths that are used in the cell update bindings. Then, this one line script in the onCellEdited
extension function will update the tags anytime an edit is made:
#def onCellEdited(self, rowIndex, colIndex, [...], newValue):
system.tag.writeBlocking(self.tagSources.getValueAt(rowIndex, colIndex), newValue)
Then row for row, column for column, store the tag paths that are used in the cell update bindings.
You had to do this manually right?