I'm using Ignition version 8.1.26. I'm a novice with Ignition so please bear with me--your feedback may be difficult for me to understand or implement.
I have a table component that correctly displays columns with their data from a database using a configure query binding. I want to allow a user to edit one of these columns, which has a data type int. I set the PROPS > Columns > "MyColumn" - editable:true. Then, I right-clicked on the table to access Event Configuration and selected onEditCellCommit* and added a script:
def runAction(self, event):
# Get the updated value and the row's unique identifier
new_value = event.value
row_data = self.props.data[event.row]['another_column_as_id']
# Call the named query to update the database
system.db.runNamedQuery("named_query", [new_value, row_data])
# Optionally, refresh the table data
self.refreshBinding("props.data")
I received this error:
Traceback (most recent call last):
File "function:runAction", line 4, in runAction
TypeError: 'com.inductiveautomation.ignition.gateway.datasource.BasicStreamingDataset' object is unsubscriptable