5 Replies Latest reply on Apr 24, 2009 6:33 PM by m_hartnett

    DataGrid prevent default keyboard navigation

      Does anyone have any idea how to get rid of the default keyboard navigation of a DataGrid? I've tried overriding keyDownHandler and listening for keyDown events, but nothing works.

      Any ideas?

        • 1. Re: DataGrid prevent default keyboard navigation
          Daniel Freeman Level 1



          Anyone?  I've wasted hours trying to do this.  I suspect it's not possible, unless you throw out all the Flex components and write everything in Pure ActionScript.  (As usual, Flex REDUCES productivity).

          • 2. Re: DataGrid prevent default keyboard navigation
            Flex harUI Adobe Employee

            What keyboard functionality are you trying to prevent or modify?  What code did you use to try to alter the functionality?


            Alex Harui

            Flex SDK Developer

            Adobe Systems Inc.

            Blog: http://blogs.adobe.com/aharui

            • 3. Re: DataGrid prevent default keyboard navigation
              Daniel Freeman Level 1

              I'd like to prevent all keyboard DataGrid navigation if I can.  Arrow keys, and especially the shortcut feature where it jumps to the cell that starts with the letter you type.


              I've tried setting up my own listeners, and the usual Flex development process of going down the list of properties and methods on the off-chance of finding something that switches this off.  As usual, I'm fighting with the Flex component trying to change it's behaviour to do what I want.


              I haven't resorted to changing DataGrid's code yet.

              • 4. Re: DataGrid prevent default keyboard navigation
                Michael Borbor Level 4

                I don't know if this works for you, but Peter deHaan has had the solution long time ago, you just need to do this


                package comps {
                     import flash.events.KeyboardEvent;
                     import mx.controls.DataGrid;
                     public class MyDG extends DataGrid {
                          public function MyDG() {
                          override protected function keyDownHandler(evt:KeyboardEvent):void {


                Hail to http://blog.flexexamples.com/ !!!

                • 5. Re: DataGrid prevent default keyboard navigation
                  m_hartnett Level 3

                  Your only solution to this is to do as Michael demonstrates.

                  Adding a listener to the base Flex object will not override the listener it will just add another listener.

                  Extending the object will allow you to customize the functionality of the base object.


                  However it is a good idea to maintain your own library of Flex extensions.

                  We extend every Flex component just in case we need to modify any functionality to meet our own needs.

                  We can add special functionality to any object just by overriding the listener.

                  Many of our objects have nothing in them right now but are just shells, however this gives us the opportunity to modify functionality in the future and not affect the application to a great extent.  You just need to make sure you call super whenever your specialized functionality needs to be bypassed.