Clear Up
SharpKit Reference

KeyNav Class

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, space, left, right, up, down, tab, esc, pageUp, pageDown, del, backspace, home, end.


var nav = new Ext.util.KeyNav({
            target : "my-element",
            left   : function(e){
            right  : function(e){
            enter  : function(e){
            // Binding may be a function specifiying fn, scope and defaultAction
            esc: {
            fn: this.onEsc,
            defaultEventAction: false
            scope : this

Namespace: Ext.util

Base Types



Name Description
defaultEventAction 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. If a falsy value is specified, no method is called on the key event. Defaults to: "stopEvent"
disabled True to disable this KeyNav instance. Defaults to: false
eventName The event to listen for to pick up key events. Defaults to: "keypress"
forceKeyDown Handle the keydown event instead of keypress. 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. Defaults to: false
ignoreInputFields Configure this as true if there are any input fields within the target, and this KeyNav should not process events from input fields, (<input>, <textarea> and elements withcontentEditable="true"`) Defaults to: false
processEvent An optional event processor function which accepts the argument list provided by the configured event of the target, and returns a keyEvent for processing by the KeyMap. This may be useful when the target is a Component with s complex event signature. Extra information from the event arguments may be injected into the event for use by the handler functions before returning it.
processEventScope The scope (this context) in which the processEvent method is executed. Defaults to: this
target The object on which to listen for the event specified by the eventName config option.


Name Description
destroy(bool) Destroy this KeyNav (this is the same as calling disable).
disable() Disables this KeyNav.
enable() Enables this KeyNav.
setDisabled(bool) Convenience function for setting disabled/enabled by boolean.
© Copyright 2005-2011 SharpKit. All rights reserved.