Hi all,
I am attempting to change a property value in a script event.
Here is the code I have:
table = self.getSibling("Table_0")
columns = table.props.columns
rowStyle = {'background-color':'var(--warningSecondary)'}
newRow = {}
for col in columns:
if col.field == 'ReqID':
pass
newRow[col.field] = {'value': pyds.getValueAt(0,col.field), 'action':'update', 'enabled':True, 'display':True, 'style':rowStyle}
newRow['updateMe'] = True
newRow['deleteMe'] = False
system.perspective.print(newRow['PartNumber']['enabled'])
This all works fine. BUT, if I add newRow['PartNumber']['enabled'] = False
before the print statement, I get a KeyError
. Why do I get this error and why can I not change this value?
EDIT:
I just discovered that I can change that value like this, by including it in the loop with an if
statement:
for col in columns:
if col.field == 'ReqID':
pass
newRow[col.field] = {'value': pyds.getValueAt(0,col.field), 'action':'update', 'enabled':True, 'display':True, 'style':rowStyle}
if col.field == 'PartNumber':
newRow['PartNumber']['enabled'] = False