Hello,
I wanted to add a new row and new data in a table in Ignition Perspective by using Dataset editor.
I have used "self.props.data[event.row][event.column] = event.value" to edit the table. I am able to edit the table but I am not able to add new row and data in the table.
How is your tabled filled (where does the data come from) ?
Data comes through the excel sheet which I have imported the excel sheet in table in Ignition Perspective.
So you have a script that imports data from an xls, converts it into a dataset, and assigns it to the table ?
If that's the case, where is that script, what triggers it ?
What do you want to achieve by adding rows to the table ?
I am using this below script to add new row in a table, but only blank row is getting added I am not able to enter any values or add any data in a table.
data = self.getSibling("Table").props.data
newRow =
data.append(newRow)
self.getSibling("Table").props.data = data
You're not answering the questions...
But don't be surprised that the row in empty if you're appending []
to your data. If you want to append data, you need to actually append it...
here's a table:
A button with this script:
def runAction(self, event):
new_row = {'value': 10, 'square': 10*10}
self.getSibling("Table_1").props.data.append(new_row)
correctly adds a row with 10
and 100
: