For up to date documentation and features, visit http://docs.sencha.com/ext-js/4-0

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.

Defined By

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   
 
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

 

Indicates which event to use for getting key presses.

Indicates which event to use for getting key presses.

Returns

  • String   

    The appropriate event name.

 
getPageX( Object event) : Number

Gets the x coordinate from the event

Gets the x coordinate from the event

Parameters

  • event : Object

    The event

Returns

  • Number   

    The x coordinate

 

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( Object event) : Number

Gets the y coordinate from the event

Gets the y coordinate from the event

Parameters

  • event : Object

    The event

Returns

  • Number   

    The y coordinate

 
getRelatedTarget( Object event) : HTMLElement

Gets the related target from the event.

Gets the related target from the event.

Parameters

  • event : Object

    The event

Returns

  • HTMLElement   

    The related target.

 
getTarget( Object event) : HTMLElement

Gets the target of the event.

Gets the target of the event.

Parameters

  • event : Object

    The event

Returns

  • HTMLElement   

    target

 
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.

Parameters

  • The : Event

    event to prevent the default

Returns

  • void   
 
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   
 

Stop the event (preventDefault and stopPropagation)

Stop the event (preventDefault and stopPropagation)

Parameters

  • The : Event

    event to stop

Returns

  • void   
 

Cancels bubbling of the event.

Cancels bubbling of the event.

Parameters

  • The : Event

    event to stop bubbling.

Returns

  • void