Sencha Documentation

Registers event handlers that want to receive a normalized EventObject instead of the standard browser event and provides several useful events directly. See Ext.EventObject for more details on normalized event objects.

Properties

 
A : Number
Key constant
Key constant
 
ALT : Number
Key constant
Key constant
 
B : Number
Key constant
Key constant
 
BACKSPACE : Number
Key constant
Key constant
 
C : Number
Key constant
Key constant
 
CAPS_LOCK : Number
Key constant
Key constant
 
CONTEXT_MENU : Number
Key constant
Key constant
 
CTRL : Number
Key constant
Key constant
 
D : Number
Key constant
Key constant
 
DELETE : Number
Key constant
Key constant
 
DOWN : Number
Key constant
Key constant
 
E : Number
Key constant
Key constant
 
EIGHT : Number
Key constant
Key constant
 
END : Number
Key constant
Key constant
 
ENTER : Number
Key constant
Key constant
 
ESC : Number
Key constant
Key constant
 
F : Number
Key constant
Key constant
 
F1 : Number
Key constant
Key constant
 
F10 : Number
Key constant
Key constant
 
F11 : Number
Key constant
Key constant
 
F12 : Number
Key constant
Key constant
 
F2 : Number
Key constant
Key constant
 
F3 : Number
Key constant
Key constant
 
F4 : Number
Key constant
Key constant
 
F5 : Number
Key constant
Key constant
 
F6 : Number
Key constant
Key constant
 
F7 : Number
Key constant
Key constant
 
F8 : Number
Key constant
Key constant
 
F9 : Number
Key constant
Key constant
 
FIVE : Number
Key constant
Key constant
 
FOUR : Number
Key constant
Key constant
 
G : Number
Key constant
Key constant
 
H : Number
Key constant
Key constant
 
HOME : Number
Key constant
Key constant
 
I : Number
Key constant
Key constant
 
INSERT : Number
Key constant
Key constant
 
J : Number
Key constant
Key constant
 
K : Number
Key constant
Key constant
 
L : Number
Key constant
Key constant
 
LEFT : Number
Key constant
Key constant
 
M : Number
Key constant
Key constant
 
N : Number
Key constant
Key constant
 
NINE : Number
Key constant
Key constant
 
NUM_CENTER : Number
Key constant
Key constant
 
NUM_DIVISION : Number
Key constant
Key constant
 
NUM_EIGHT : Number
Key constant
Key constant
 
NUM_FIVE : Number
Key constant
Key constant
 
NUM_FOUR : Number
Key constant
Key constant
 
NUM_MINUS : Number
Key constant
Key constant
 
NUM_MULTIPLY : Number
Key constant
Key constant
 
NUM_NINE : Number
Key constant
Key constant
 
NUM_ONE : Number
Key constant
Key constant
 
NUM_PERIOD : Number
Key constant
Key constant
 
NUM_PLUS : Number
Key constant
Key constant
 
NUM_SEVEN : Number
Key constant
Key constant
 
NUM_SIX : Number
Key constant
Key constant
 
NUM_THREE : Number
Key constant
Key constant
 
NUM_TWO : Number
Key constant
Key constant
 
NUM_ZERO : Number
Key constant
Key constant
 
O : Number
Key constant
Key constant
 
ONE : Number
Key constant
Key constant
 
P : Number
Key constant
Key constant
 
PAGE_DOWN : Number
Key constant
Key constant
 
PAGE_UP : Number
Key constant
Key constant
 
PAUSE : Number
Key constant
Key constant
 
PRINT_SCREEN : Number
Key constant
Key constant
 
Q : Number
Key constant
Key constant
 
R : Number
Key constant
Key constant
 
RETURN : Number
Key constant
Key constant
 
RIGHT : Number
Key constant
Key constant
 
S : Number
Key constant
Key constant
 
SEVEN : Number
Key constant
Key constant
 
SHIFT : Number
Key constant
Key constant
 
SIX : Number
Key constant
Key constant
 
SPACE : Number
Key constant
Key constant
 
T : Number
Key constant
Key constant
 
TAB : Number
Key constant
Key constant
 
THREE : Number
Key constant
Key constant
 
TWO : Number
Key constant
Key constant
 
U : Number
Key constant
Key constant
 
UP : Number
Key constant
Key constant
 
V : Number
Key constant
Key constant
 
W : Number
Key constant
Key constant
 
X : Number
Key constant
Key constant
 
Y : Number
Key constant
Key constant
 
Z : Number
Key constant
Key constant
 
ZERO : Number
Key constant
Key constant

Methods

 
addListener( String/HTMLElement el, String eventName, Function handler, [Object scope], [Object options] ) : Void
Appends an event handler to an element. The shorthand version on is equivalent. Typically you will use Ext.core.Ele...
Appends an event handler to an element. The shorthand version on is equivalent. Typically you will use Ext.core.Element.addListener directly on an Element in favor of calling this version.

Parameters

  • el : String/HTMLElement
    The html element or id to assign the event handler to.
  • eventName : String
    The name of the event to listen for.
  • handler : Function
    The handler function the event invokes. This function is passed the following parameters:
    • evt : EventObject
      The EventObject describing the event.
    • t : Element
      The Element which was the target of the event. Note that this may be filtered by using the delegate option.
    • o : Object
      The options object from the addListener call.
  • scope : Object
    (optional) The scope (this reference) in which the handler function is executed. Defaults to the Element.
  • options : Object
    (optional) An object containing handler configuration properties. This may contain any of the following properties:
    • scope : Object
      The scope (this reference) in which the handler function is executed. Defaults to the Element.
    • delegate : String
      A simple selector to filter the target or look for a descendant of the target
    • stopEvent : Boolean
      True to stop the event. That is stop propagation, and prevent the default action.
    • preventDefault : Boolean
      True to prevent the default action
    • stopPropagation : Boolean
      True to prevent event propagation
    • normalized : Boolean
      False to pass a browser event to the handler function instead of an Ext.EventObject
    • delay : Number
      The number of milliseconds to delay the invocation of the handler after te event fires.
    • single : Boolean
      True to add a handler to handle just the next firing of the event, and then remove itself.
    • buffer : Number
      Causes the handler to be scheduled to run in an Ext.util.DelayedTask delayed by the specified number of milliseconds. If the event fires again within that time, the original handler is not invoked, but the new handler is scheduled in its place.
    • target : Element
      Only call the handler if the event was fired on the target Element, not if the event was bubbled up from a child node.

    See Ext.core.Element.addListener for examples of how to use these options.

Returns

  • Void
 
getCharCode : Number
Gets the character code for the event.
Gets the character code for the event.
 
getId( Mixed element ) : String
Get the id of the element. If one has not been assigned, automatically assign it.
Get the id of the element. If one has not been assigned, automatically assign it.

Parameters

  • element : Mixed
    The element to get the id for.

Returns

  • String   id
 
getKey : Number
Returns a normalized keyCode for the event.
Returns a normalized keyCode for the event.
 
getKeyEvent : String
Indicates which event to use for getting key presses.
Indicates which event to use for getting key presses.
 
getPageX : Number
Gets the x coordinate of the event.
Gets the x coordinate of the event.
 
getPageXY( Object event ) : Array
Gets the x & ycoordinate from the event
Gets the x & ycoordinate from the event

Parameters

  • event : Object
    The event

Returns

  • Array   The x/y coordinate
 
getPageY : Number
Gets the y coordinate of the event.
Gets the y coordinate of the event.
 
getPoint : Ext.util.Point
Returns a point object that consists of the object coordinates.
Returns a point object that consists of the object coordinates.
 
getRelatedTarget( [String selector], [Number/Mixed maxDepth], [Boolean returnEl] ) : HTMLElement
Gets the related target.
Gets the related target.

Parameters

  • selector : String
    (optional) A simple selector to filter the target or look for an ancestor of the target
  • maxDepth : Number/Mixed
    (optional) The max depth to search as a number or element (defaults to 10 || document.body)
  • returnEl : Boolean
    (optional) True to return a Ext.core.Element object instead of DOM node

Returns

  • HTMLElement   undefined
 
getTarget( [String selector], [Number/Mixed maxDepth], [Boolean returnEl] ) : HTMLelement
Gets the target for the event.
Gets the target for the event.

Parameters

  • selector : String
    (optional) A simple selector to filter the target or look for an ancestor of the target
  • maxDepth : Number/Mixed
    (optional) The max depth to search as a number or element (defaults to 10 || document.body)
  • returnEl : Boolean
    (optional) True to return a Ext.core.Element object instead of DOM node

Returns

  • HTMLelement   undefined
 
getWheelDelta : Number
Normalizes mouse wheel delta across browsers
Normalizes mouse wheel delta across browsers
 
getXY : Array
Gets the page coordinates of the event.
Gets the page coordinates of the event.
 
hasModifier : Boolean
Returns true if the control, meta, shift or alt key was pressed during this event.
Returns true if the control, meta, shift or alt key was pressed during this event.
 
isNavKeyPress : Boolean
Checks if the key pressed was a "navigation" key
Checks if the key pressed was a "navigation" key
 
isSpecialKey : Boolean
Checks if the key pressed was a "special" key
Checks if the key pressed was a "special" key
 
onDocumentReady( Function fn, [Object scope], [boolean options] ) : Void
Adds a listener to be notified when the document is ready (before onload and before images are loaded). Can be access...
Adds a listener to be notified when the document is ready (before onload and before images are loaded). Can be accessed shorthanded as Ext.onReady().

Parameters

  • fn : Function
    The method the event invokes.
  • scope : Object
    (optional) The scope (this reference) in which the handler function executes. Defaults to the browser window.
  • options : boolean
    (optional) Options object as passed to Ext.core.Element.addListener.

Returns

  • Void
 
onWindowResize( Function fn, Object scope, boolean options ) : Void
Adds a listener to be notified when the browser window is resized and provides resize event buffering (100 millisecon...
Adds a listener to be notified when the browser window is resized and provides resize event buffering (100 milliseconds), passes new viewport width and height to handlers.

Parameters

  • fn : Function
    The handler function the window resize event invokes.
  • scope : Object
    The scope (this reference) in which the handler function executes. Defaults to the browser window.
  • options : boolean
    Options object as passed to Ext.core.Element.addListener

Returns

  • Void
 
Prevents the browsers default handling of the event.
Prevents the browsers default handling of the event.
 
purgeElement( String/HTMLElement el, [String eventName] ) : Void
Recursively removes all previous added listeners from an element and its children. Typically you will use Ext.core.El...
Recursively removes all previous added listeners from an element and its children. Typically you will use Ext.core.Element.purgeAllListeners directly on an Element in favor of calling this version.

Parameters

  • el : String/HTMLElement
    The id or html element from which to remove all event handlers.
  • eventName : String
    (optional) The name of the event.

Returns

  • Void
 
removeAll( String/HTMLElement el ) : Void
Removes all event handers from an element. Typically you will use Ext.core.Element.removeAllListeners directly on an...
Removes all event handers from an element. Typically you will use Ext.core.Element.removeAllListeners directly on an Element in favor of calling this version.

Parameters

  • el : String/HTMLElement
    The id or html element from which to remove all event handlers.

Returns

  • Void
 
removeListener( String/HTMLElement el, String eventName, Function fn, Object scope ) : Void
Removes an event handler from an element. The shorthand version un is equivalent. Typically you will use Ext.core.E...
Removes an event handler from an element. The shorthand version un is equivalent. Typically you will use Ext.core.Element.removeListener directly on an Element in favor of calling this version.

Parameters

  • el : String/HTMLElement
    The id or html element from which to remove the listener.
  • eventName : String
    The name of the event.
  • fn : Function
    The handler function to remove. This must be a reference to the function passed into the addListener call.
  • scope : Object
    If a scope (this reference) was specified when the listener was added, then this must refer to the same object.

Returns

  • Void
 
removeResizeListener( Function fn, Object scope ) : Void
Removes the passed window resize listener.
Removes the passed window resize listener.

Parameters

  • fn : Function
    The method the event invokes
  • scope : Object
    The scope of handler

Returns

  • Void
 
removeUnloadListener( Function fn, Object scope ) : Void
Removes the passed window unload listener.
Removes the passed window unload listener.

Parameters

  • fn : Function
    The method the event invokes
  • scope : Object
    The scope of handler

Returns

  • Void
 
stopEvent : Void
Stop the event (preventDefault and stopPropagation)
Stop the event (preventDefault and stopPropagation)
 
Cancels bubbling of the event.
Cancels bubbling of the event.
 
within( Mixed el, [Boolean related], Boolean allowEl ) : Boolean
Returns true if the target of this event is a child of el. Unless the allowEl parameter is set, it will return false...
Returns true if the target of this event is a child of el. Unless the allowEl parameter is set, it will return false if if the target is el. Example usage:
// Handle click on any child of an element
Ext.getBody().on('click', function(e){
    if(e.within('some-el')){
        alert('Clicked on a child of some-el!');
    }
});

// Handle click directly on an element, ignoring clicks on child nodes
Ext.getBody().on('click', function(e,t){
    if((t.id == 'some-el') && !e.within(t, true)){
        alert('Clicked directly on some-el!');
    }
});

Parameters

  • el : Mixed
    The id, DOM element or Ext.core.Element to check
  • related : Boolean
    (optional) true to test if the related target is within el instead of the target
  • allowEl : Boolean
    {optional} true to also check if the passed element is the target or related target

Returns

  • Boolean   undefined