# dataGrid get the edited cell value problem

**URL:** <https://forum.kirupa.com/t/datagrid-get-the-edited-cell-value-problem/242460>\
**Category:** flash\
**Created:** [October 26, 2007, 6:56am UTC](https://forum.kirupa.com/t/datagrid-get-the-edited-cell-value-problem/242460 "2007-10-26T06:56:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![buttface](https://avatars.discourse-cdn.com/v4/letter/b/b9bd4f/32.png) [@buttface](https://forum.kirupa.com/u/buttface)\
**Post date:** [October 26, 2007, 6:56am UTC](https://forum.kirupa.com/t/datagrid-get-the-edited-cell-value-problem/242460/1 "2007-10-26T06:56:17Z")

</div>

```auto

var myListener_obj:Object = new Object();
myListener_obj.cellEdit = function(evt_obj:Object) {
 
 var myColumn:String = dgProducts.columnNames[evt_obj.columnIndex];
 trace(dgProducts.getItemAt(evt_obj.itemIndex).myColumn);
 
};
// Add listener object.
dgProducts.addEventListener("cellEdit", myListener_obj);

```

Hello,

I grab some data from my db and insert it to a dataGrid(dgProducts). I then want be able to edit the values and save it back to the db. But I have problems grabbing the new value of the cell that was edited.

Lets say that I have 2 columns, “id” and “brand” and I use a event listener that checks for an edited cell. I then need to find out what cell was edited, and I can get the cells X:Y position.

With “dgProducts.columnNames[evt\_obj.columnIndex]” get the column(X) name that was edited, and with “evt\_obj.itemIndex” get the row(Y).

Finally with “getItemAt()” function I should be able to get the edited cell valule since I do have the column name and I do have the row index.

However with the code example above I get “undefined”, but if I use hardcoded:  
“dgProducts.getItemAt(evt\_obj.itemIndex). **brand** ” it gives me what I want. This I’m afraid is not an option since I will be using a lot of tables and I do not want to hardcode each column name.

Can someone enlighten me why the code doesn’t work, and show me a working example?
