Reputation: 293
I want to know, how do I get the selected index, if I change the selection of a datagrid row. I´ve searched a lot and have found only the Adobe site
This is what I think is the right way:
myGrid.addEventListener(DataGridEvent.ITEM_FOCUS_IN, datagridchanged);
//DataGrid Changed Listener function
private function datagridchanged (e:DataGridEvent):void{
trace(e.selectedIndex); //Don`t know if .selectedIndex is correct
}
But nothing works, if someone could help me please?
Thanks in advance
Upvotes: 0
Views: 990
Reputation:
If you simply want to know which item has been selected, you can listen to Event.CHANGE
on your DataGrid.
Like this, for example:
mygrid.addEventListener(Event.CHANGE, onGridSelectedItem);
function onGridSelectedItem(e:Event):void{
var selected:int = mygrid.selectedIndex;
var item:Object = mygrid.selectedItem;
}
Upvotes: 1