import fl.controls.DataGrid;
import fl.data.DataProvider;
var dataGrid:DataGrid = new DataGrid();
dataGrid.x = 100;
dataGrid.y = 100;
dataGrid.setSize(400,200)
addChild(dataGrid);
var d:Array = new Array();
d = [{姓名:'张三',一月:200,二月:300,三月:400, rowColor:'red'},
{姓名:'李四',一月:300,二月:400,三月:500, rowColor:'green'},
{姓名:'王五',一月:400,二月:500,三月:600, rowColor:'yellow'}];
dataGrid.dataProvider = new DataProvider(d);
dataGrid.columns = ['姓名','一月','二月' , '三月'];
dataGrid.addEventListener(ListEvent.ITEM_CLICK, itemClickHandler); //选择一行
function itemClickHandler(e:ListEvent):void{
var tmp:DataGrid = e.target as DataGrid;
var lie_name:String = tmp.columns[e.columnIndex].dataField;
trace(lie_name,e.item[lie_name]); //点击的单元格内容
function itemClickHandler(e:ListEvent):void{
var tmp:DataGrid = e.target as DataGrid;
var lie_name:String = tmp.columns[e.columnIndex].dataField;
trace(lie_name,e.item[lie_name]); //点击的单元格内容
}