I realize that ItemFocusIn is somehow only applicable to editable datagrids in flex, nevertheless I want to fire an event anytime the user selects a new row in a non-editable datagrid. I have successfully used the CLICK event, but this event is not fired when the user uses the keyboard to select a different row in the datagrid. What do I have to do to cause an event to fire whenever the currently highlighted row in the datagrid changes, regardless of weather it was changed by the mouse or by the keyboard?
A:
You should listen for selectedIndex change. Take a look at this code, the method dataGridselectedRowChanged is going to be called every time you change the row in the grid.
public function set dataGridselectedRowChanged(id:int):void{
trace(id);
}
<fx:Binding source="{myDG.selectedIndex}" destination="dataGridselectedRowChanged"/>
<mx:DataGrid id="myDG" width="350" >
Cornel Creanga
2010-04-19 09:14:34