Hi everyone!
What do I have to do to get the value of a selectedItem in a DataGrid? I wan’t this to happen dynamically.
1 This works:
trace(event.currentTarget.selectedItem.station_name);
Here I give the selectedItem an existing object, station_name. And it works - it gives me the value of that column/row. But this is not dynamic…
**2 But I have an array consisting of the headerText values of the DataGrid I’m running the selectedItem on. **
var rowDataField:String = array[event.columnIndex].headerText
So:
How do i glue *event.currentTarget.selectedItem *and the value of rowDataField together to form a valid statement?
For example,
trace(event.currentTarget.selectedItem.[rowDataField];
The rowDataField could be:
trace(event.currentTarget.selectedItem.station_name
trace(event.currentTarget.selectedItem.station_type
trace(event.currentTarget.selectedItem.station_address
This would then give the value that I’d want
Any ideas anyone? This is getting frustrating…
Kenwio