Class Ext.EventObject
EventObject exposes the Yahoo! UI Event functionality directly on the object
passed to your event handler. It exists mostly for convenience. It also fixes the annoying null checks automatically to cleanup your code
Example:
function handleClick(e){ // e is not a standard event object, it is a Ext.EventObject
e.preventDefault();
var target = e.getTarget();
...
}
var myDiv = Ext.get("myDiv");
myDiv.on("click", handleClick);
//or
Ext.EventManager.on("myDiv", 'click', handleClick);
Ext.EventManager.addListener("myDiv", 'click', handleClick);
This class is a singleton and cannot be created directly.
Public Properties
|
BACKSPACE : Number
Key constant
|
EventObject |
|
CONTROL : Number
Key constant
|
EventObject |
|
DELETE : Number
Key constant
|
EventObject |
|
DOWN : Number
Key constant
|
EventObject |
|
END : Number
Key constant
|
EventObject |
|
ENTER : Number
Key constant
|
EventObject |
|
ESC : Number
Key constant
|
EventObject |
|
F5 : Number
Key constant
|
EventObject |
|
HOME : Number
Key constant
|
EventObject |
|
LEFT : Number
Key constant
|
EventObject |
|
PAGEDOWN : Number
Key constant
|
EventObject |
|
PAGEUP : Number
Key constant
|
EventObject |
|
RETURN : Number
Key constant
|
EventObject |
|
RIGHT : Number
Key constant
|
EventObject |
|
SHIFT : Number
Key constant
|
EventObject |
|
SPACE : Number
Key constant
|
EventObject |
|
TAB : Number
Key constant
|
EventObject |
|
UP : Number
Key constant
|
EventObject |
|
altKey : Object
True if the alt key was down during the event
|
EventObject |
|
browserEvent : Object
The normal browser event
|
EventObject |
|
button : Object
The button pressed in a mouse event
|
EventObject |
|
ctrlKey : Object
True if the control key was down during the event
|
EventObject |
|
shiftKey : Object
True if the shift key was down during the event
|
EventObject |
Public Methods
|
getCharCode() : Number
Gets the key code for the event.
Gets the key code for the event.
|
EventObject |
|
getKey() : Number
Returns a normalized keyCode for the event.
Returns a normalized keyCode for the event.
|
EventObject |
|
getPageX() : Number
Gets the x coordinate of the event.
Gets the x coordinate of the event.
|
EventObject |
|
getPageY() : Number
Gets the y coordinate of the event.
Gets the y coordinate of the event.
|
EventObject |
|
getRelatedTarget() : HTMLElement
|
EventObject |
|
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.Element object instead of DOM node
Returns:
|
EventObject |
|
getTime() : Number
Gets the time of the event.
Gets the time of the event.
|
EventObject |
|
getWheelDelta() : Number
Normalizes mouse wheel delta across browsers
Normalizes mouse wheel delta across browsers
|
EventObject |
|
getXY() : Array
Gets the page coordinates of the event.
Gets the page coordinates of the event.
|
EventObject |
|
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.
|
EventObject |
|
preventDefault() : void
Prevents the browsers default handling of the event.
Prevents the browsers default handling of the event.
|
EventObject |
|
stopEvent() : void
Stop the event (preventDefault and stopPropagation)
Stop the event (preventDefault and stopPropagation)
|
EventObject |
|
stopPropagation() : void
Cancels bubbling of the event.
Cancels bubbling of the event.
|
EventObject |
|
within( Mixed el , [Boolean related ] ) : Boolean
Returns true if the target of this event equals el or is a child of el
Returns true if the target of this event equals el or is a child of el
|
EventObject |
Public Events
This class has no public events.