# \[Bug\] onEditCellCommit updating self.props.data\[row\]\[column\]

**URL:** <https://forum.inductiveautomation.com/t/bug-oneditcellcommit-updating-self-props-data-row-column/73289>\
**Category:** Ignition\
**Tags:** perspective, ignition81\
**Created:** [May 4, 2023, 8:50pm UTC](https://forum.inductiveautomation.com/t/bug-oneditcellcommit-updating-self-props-data-row-column/73289 "2023-05-04T20:50:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mason\_1](https://avatars.discourse-cdn.com/v4/letter/m/ee59a6/32.png) [@Mason\_1](https://forum.inductiveautomation.com/u/Mason_1)\
**Post date:** [May 4, 2023, 8:50pm UTC](https://forum.inductiveautomation.com/t/bug-oneditcellcommit-updating-self-props-data-row-column/73289/1 "2023-05-04T20:50:50Z")

</div>

**1. The behavior you unexpectedly encountered** -  
inside of onEditCellCommit on setting self.props.data[row][column] = "Hello World" did not update

**2. The behavior you were expecting to see** - again, one line is fine.  
expected to update the value of self.props.data[row][column] to "Hello World"

**3. A list of the steps you took that exposed the issue**  
my grid data was created with an array of dicts

right click on grid "configure events"  
select onEditCellCommit

```auto
def runAction(self, event):
	"""
	Fired when a user has effectively committed an edit on a cell via return or
	enter key press.

	Arguments:
		self: A reference to the component that is invoking this function.
		event: An object with the following attributes:
			column (int | str): The column of the edited cell.
			row (int): The unique row index as it is represented in the source
			           data. Also known as the row ID.
			rowIndex (int): The row index as it is represented in the current
			                visible data.
			value (bool | int | float | str): The committed value.
	"""
	#the default value in this case is: center
	self.props.data[event.row][event.column] = "Hello World"
	system.perspective.print(self.props.data[event.row][event.column])

```

expected this to print "Hello World" it printed "center"  
expected a error if there is a error received no log or error

**4. The answer**  
after long debugging I discovered the reason

```auto
def runAction(self, event):
	"""
	Fired when a user has effectively committed an edit on a cell via return or
	enter key press.

	Arguments:
		self: A reference to the component that is invoking this function.
		event: An object with the following attributes:
			column (int | str): The column of the edited cell.
			row (int): The unique row index as it is represented in the source
			           data. Also known as the row ID.
			rowIndex (int): The row index as it is represented in the current
			                visible data.
			value (bool | int | float | str): The committed value.
	"""

	currentConfigTableData = self.props.data
	changedRow = {}
	for column in currentConfigTableData[event.row].items():
		if column[0] == event.column:
			column[1] = event.value
		system.perspective.print(column)
		changedRow.update({column})

```

this does throw an error currentConfigTableData[event.row].items() is a list of tuples  
if this is the case I would want  
self.props.data[event.row][event.column] = "Hello World"  
to throw an error as well stating that is the case and not flow though without an error

edit: formatting

---

<div class="post-metadata">

**Author:** ![Mason\_1](https://avatars.discourse-cdn.com/v4/letter/m/ee59a6/32.png) [@Mason\_1](https://forum.inductiveautomation.com/u/Mason_1)\
**Post date:** [May 4, 2023, 8:59pm UTC](https://forum.inductiveautomation.com/t/bug-oneditcellcommit-updating-self-props-data-row-column/73289/2 "2023-05-04T20:59:24Z")

</div>

this was my solution

```auto
def runAction(self, event):
	"""
	Fired when a user has effectively committed an edit on a cell via return or
	enter key press.

	Arguments:
		self: A reference to the component that is invoking this function.
		event: An object with the following attributes:
			column (int | str): The column of the edited cell.
			row (int): The unique row index as it is represented in the source
			           data. Also known as the row ID.
			rowIndex (int): The row index as it is represented in the current
			                visible data.
			value (bool | int | float | str): The committed value.
	"""

	currentConfigTableData = self.props.data
	changedRow = {}
	for column in currentConfigTableData[event.row].items():
		column_ = column
		if column[0] == event.column:
			column_ = (event.column, event.value)
		changedRow.update({column_})
	
	system.perspective.print(changedRow)
	currentConfigTableData[event.row] = changedRow
	self.props.data = currentConfigTableData

```

edit: fixes
