我有一个flex可编辑数据网格mx:DataGrid,当我按TAB键时,它在我编辑单元格时会更改为另一个单元格。
当我按TAB时,我不希望它更改为另一个单元格。我怎么能阻止这种行为?
谢谢,菲利普
答案 0 :(得分:3)
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" minWidth="955" minHeight="600">
<mx:Script>
<![CDATA[
import mx.events.FlexEvent;
protected function dataGrid_keyFocusChangeHandler(event:FocusEvent):void
{
if (event.keyCode == Keyboard.TAB)
event.preventDefault();
}
]]>
</mx:Script>
<mx:DataGrid id="dataGrid" editable="true" keyFocusChange="dataGrid_keyFocusChangeHandler(event)">
<mx:dataProvider>
<mx:ArrayCollection>
<mx:Object a="a1" b="b1"/>
<mx:Object a="a2" b="b2"/>
</mx:ArrayCollection>
</mx:dataProvider>
</mx:DataGrid>
</mx:Application>