1
votes

I have a flex editable datagrid mx:DataGrid and when I press TAB key, it changes to another cell when I am editing a cell.

I don't want it to change to another cell when I press TAB. How can I stop this behavior?

Thanks, Philip

1

1 Answers

3
votes
<?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>