I am trying to make an editable DataGrid to insert a new row when user presses TAB in the last column of last row.
My Grid:
<mx:DataGrid id="myGrid"
dataProvider="{initDG}" editable="true"
itemFocusOut="onItemFocusOut(event)">
<mx:columns>
<mx:DataGridColumn dataField="Company" editable="false"/>
<mx:DataGridColumn dataField="Contact"/>
</mx:columns>
</mx:DataGrid>
My onItemFocusOut event:
protected function onItemFocusOut(e: DataGridEvent):void{
if((e.rowIndex == (initDG.length - 1)) &&
(e.columnIndex == (myGrid.columnCount -1))){
initDG.addItem({Company: 'New one', Contact: ''});
}
}
It works fine, meaning it inserts a new row. The problem is that flex focuses on the next component and I need it to focus on the recently created row.
Is it possible?
Thnaks