PDA

View Full Version : Getting the text value of a DataGrid cell


JRBT
12-03-2004, 01:46 PM
Hi everyone!

I have a quick question about the DataGrid.

I realize that getSelectedIndex() will return the ID of the row in focus on the grid, but how do I get the text value of a focused cell within the row?

Thanks in advance,

Joe

sandhyanayak
12-16-2004, 11:53 AM
Hi Joe!

Just write this event handler and change the instance of the grid as per ur convienent and see what will dispy it.

myListener.cellPress = function(event)
{
var colName=mcGrd.getColumnAt(event.columnIndex).colum nName
var cellValue=mcGrd.selectedItem[colName]
trace("cellValue: "+cellValue)

};

dwalsh9x
01-06-2005, 03:33 PM
I do it this way, which seems a little more straightforward.

myDataGrid.addEventListener("change", myDataGridChange);
function myDataGridChange(eventObj:Object):Void {
myTextArea.text = myDataGrid.selectedItem.ColumnName;
}

zhier81
01-08-2005, 08:30 AM
dwalsh9x:you don't get the text value of the selected item!