Get selected column index and row index
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute">
<mx:Script>
import mx.events.ListEvent;
private function itemClickEvent(event:ListEvent):void {
clickColumn.text=String(event.columnIndex);
clickRow.text=String(event.rowIndex);
eventType.text=event.type;
}
</mx:Script>
<mx:DataGrid id="myGrid" width="350" height="150" itemClick="itemClickEvent(event);" x="112" y="10">
<mx:ArrayCollection>
<mx:Object Artist="A" Album="aa" Price="11.99" />
<mx:Object Artist="B" Album="bb" Price="11.99" />
</mx:ArrayCollection>
</mx:DataGrid>
<mx:TextArea id="clickColumn" x="191" y="199" />
<mx:TextArea id="clickRow" x="191" y="253" />
<mx:TextArea id="eventType" x="191" y="305" />
</mx:Application>
Related examples in the same category