Print Friendly

Class Ext.KeyNav

Package:Ext
Class:KeyNav
Extends:Object
Defined In:KeyNav.js

Provides a convenient wrapper for normalized keyboard navigation. KeyNav allows you to bind navigation keys to function calls that will get called when the keys are pressed, providing an easy way to implement custom navigation schemes for any UI component.

The following are all of the possible keys that can be implemented: enter, left, right, up, down, tab, esc, pageUp, pageDown, del, home, end. Usage:

var nav = new Ext.KeyNav("my-element", {
    "left" : function(e){
        this.moveLeft(e.ctrlKey);
    },
    "right" : function(e){
        this.moveRight(e.ctrlKey);
    },
    "enter" : function(e){
        this.save();
    },
    scope : this
});

Properties   -  Methods   -  Events   -  Config Options

Public Properties

This class has no public properties.

Public Methods

Method Defined By
  KeyNavString/HTMLElement/Ext.Element el, Object config ) KeyNav
  disable() : void KeyNav
Disable this KeyNav
  enable() : void KeyNav
Enable this KeyNav

Public Events

This class has no public events.

Config Options

Config Options Defined By
  defaultEventAction : String KeyNav
The method to call on the Ext.EventObject after this KeyNav intercepts a key. Valid values are Ext.EventObject.stopEv...
  disabled : Boolean KeyNav
True to disable this KeyNav instance (defaults to false)
  forceKeyDown : Boolean KeyNav
Handle the keydown event instead of keypress (defaults to false). KeyNav automatically does this for IE since IE does...

Constructor Details

KeyNav

public function KeyNav( String/HTMLElement/Ext.Element el, Object config )
Parameters:
  • el : String/HTMLElement/Ext.Element
    The element to bind to
  • config : Object
    The config

Method Details

disable

public function disable()
Disable this KeyNav
Parameters:
  • None.
Returns:
  • void
This method is defined by KeyNav.

enable

public function enable()
Enable this KeyNav
Parameters:
  • None.
Returns:
  • void
This method is defined by KeyNav.

Config Details

defaultEventAction

defaultEventAction : String
The method to call on the Ext.EventObject after this KeyNav intercepts a key. Valid values are Ext.EventObject.stopEvent, Ext.EventObject.preventDefault and Ext.EventObject.stopPropagation (defaults to 'stopEvent')
This config option is defined by KeyNav.

disabled

disabled : Boolean
True to disable this KeyNav instance (defaults to false)
This config option is defined by KeyNav.

forceKeyDown

forceKeyDown : Boolean
Handle the keydown event instead of keypress (defaults to false). KeyNav automatically does this for IE since IE does not propagate special keys on keypress, but setting this to true will force other browsers to also handle keydown instead of keypress.
This config option is defined by KeyNav.

Ext - Copyright © 2006-2007 Ext JS, LLC
All rights reserved.