dataGrid get the edited cell value problem


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?