Ext.dom.Element
Alternate names
Ext.ElementExt.core.ElementHierarchy
Ext.BaseExt.dom.AbstractElementExt.dom.ElementSubclasses
Files
Encapsulates a DOM element, adding simple DOM manipulation facilities, normalizing for browser differences.
All instances of this class inherit the methods of Ext.fx.Anim making visual effects easily available to all DOM elements.
Note that the events documented in this class are not Ext events, they encapsulate browser events. Some older browsers may not support the full range of events. Which events are supported is beyond the control of Ext JS.
Usage:
// by id
var el = Ext.get("my-div");
// by DOM element reference
var el = Ext.get(myDivElement);
Animations
When an element is manipulated, by default there is no animation.
var el = Ext.get("my-div");
// no animation
el.setWidth(100);
Many of the functions for manipulating an element have an optional "animate" parameter. This parameter can be specified as boolean (true) for default animation effects.
// default animation
el.setWidth(100, true);
To configure the effects, an object literal with animation options to use as the Element animation configuration object can also be specified. Note that the supported Element animation configuration options are a subset of the Ext.fx.Anim animation options specific to Fx effects. The supported Element animation configuration options are:
Option Default Description
--------- -------- ---------------------------------------------
duration 350 The duration of the animation in milliseconds
easing easeOut The easing method
callback none A function to execute when the anim completes
scope this The scope (this) of the callback function
Usage:
// Element animation options object
var opt = {
duration: 1000,
easing: 'elasticIn',
callback: this.foo,
scope: this
};
// animation with some options set
el.setWidth(100, opt);
The Element animation object being used for the animation will be set on the options object as "anim", which allows you to stop or manipulate the animation. Here is an example:
// using the "anim" property to get the Anim object
if(opt.anim.isAnimated()){
opt.anim.stop();
}
Composite (Collections of) Elements
For working with collections of Elements, see Ext.CompositeElement
Available since: 1.1.0
Properties
Instance Properties Defined in override Ext.dom.AbstractElement_alignment. ...Defined in override Ext.dom.AbstractElement_alignment.
Defaults to: /^([a-z]+)-([a-z]+)(\?)?$/
Available since: 4.1.2
True to automatically adjust width and height settings for box-model issues. ...True to automatically adjust width and height settings for box-model issues.
Defaults to: true
Available since: 1.1.0
The default unit to append to CSS values where a unit isn't provided. ...The default unit to append to CSS values where a unit isn't provided.
Overridden in Ext.dom.AbstractElement_static.
Defaults to: "px"
Available since: 4.1.0
The element's default display mode. ...The element's default display mode.
Defined in override Ext.dom.Element_fx.
Defaults to: ""
Available since: 1.1.0
Get the reference to the current class from which this object was instantiated. ...Get the reference to the current class from which this object was instantiated. Unlike statics,
this.self is scope-dependent and it's meant to be used for dynamic inheritance. See statics
for a detailed comparison
Ext.define('My.Cat', {
statics: {
speciesName: 'Cat' // My.Cat.speciesName = 'Cat'
},
constructor: function() {
alert(this.self.speciesName); // dependent on 'this'
},
clone: function() {
return new this.self();
}
});
Ext.define('My.SnowLeopard', {
extend: 'My.Cat',
statics: {
speciesName: 'Snow Leopard' // My.SnowLeopard.speciesName = 'Snow Leopard'
}
});
var cat = new My.Cat(); // alerts 'Cat'
var snowLeopard = new My.SnowLeopard(); // alerts 'Snow Leopard'
var clone = snowLeopard.clone();
alert(Ext.getClassName(clone)); // alerts 'My.SnowLeopard'
Available since: 4.0.0
styleHooks : ObjectprivateThis shared object is keyed by style name (e.g., 'margin-left' or 'marginLeft'). ...This shared object is keyed by style name (e.g., 'margin-left' or 'marginLeft'). The
values are objects with the following properties:
name (String) : The actual name to be presented to the DOM. This is typically the value
returned by normalize.
get (Function) : A hook function that will perform the get on this style. These
functions receive "(dom, el)" arguments. The dom parameter is the DOM Element
from which to get ths tyle. The el argument (may be null) is the Ext.Element.
set (Function) : A hook function that will perform the set on this style. These
functions receive "(dom, value, el)" arguments. The dom parameter is the DOM Element
from which to get ths tyle. The value parameter is the new value for the style. The
el argument (may be null) is the Ext.Element.
The this pointer is the object that contains get or set, which means that
this.name can be accessed if needed. The hook functions are both optional.
Defined in override Ext.dom.AbstractElement_style.
Defaults to: {}
Available since: 4.1.0
Defined in override Ext.dom.AbstractElement_alignment.
Defaults to: /^([a-z]+)-([a-z]+)(\?)?$/
Available since: 4.1.2
True to automatically adjust width and height settings for box-model issues.
Defaults to: true
Available since: 1.1.0
The default unit to append to CSS values where a unit isn't provided.
Overridden in Ext.dom.AbstractElement_static.
Defaults to: "px"
Available since: 4.1.0
The element's default display mode.
Defined in override Ext.dom.Element_fx.
Defaults to: ""
Available since: 1.1.0
Get the reference to the current class from which this object was instantiated. Unlike statics,
this.self is scope-dependent and it's meant to be used for dynamic inheritance. See statics
for a detailed comparison
Ext.define('My.Cat', {
statics: {
speciesName: 'Cat' // My.Cat.speciesName = 'Cat'
},
constructor: function() {
alert(this.self.speciesName); // dependent on 'this'
},
clone: function() {
return new this.self();
}
});
Ext.define('My.SnowLeopard', {
extend: 'My.Cat',
statics: {
speciesName: 'Snow Leopard' // My.SnowLeopard.speciesName = 'Snow Leopard'
}
});
var cat = new My.Cat(); // alerts 'Cat'
var snowLeopard = new My.SnowLeopard(); // alerts 'Snow Leopard'
var clone = snowLeopard.clone();
alert(Ext.getClassName(clone)); // alerts 'My.SnowLeopard'
Available since: 4.0.0
This shared object is keyed by style name (e.g., 'margin-left' or 'marginLeft'). The values are objects with the following properties:
name(String) : The actual name to be presented to the DOM. This is typically the value returned by normalize.get(Function) : A hook function that will perform the get on this style. These functions receive "(dom, el)" arguments. Thedomparameter is the DOM Element from which to get ths tyle. Theelargument (may be null) is the Ext.Element.set(Function) : A hook function that will perform the set on this style. These functions receive "(dom, value, el)" arguments. Thedomparameter is the DOM Element from which to get ths tyle. Thevalueparameter is the new value for the style. Theelargument (may be null) is the Ext.Element.
The this pointer is the object that contains get or set, which means that
this.name can be accessed if needed. The hook functions are both optional.
Defined in override Ext.dom.AbstractElement_style.
Defaults to: {}
Available since: 4.1.0
Static Properties Visibility mode constant for use with Ext.dom.Element.setVisibilityMode. ...Visibility mode constant for use with Ext.dom.Element.setVisibilityMode.
Add or remove the Ext.Layer.visibilityCls class to hide the element.
Defaults to: 4
Available since: 4.1.0
Visibility mode constant for use with Ext.dom.Element.setVisibilityMode. ...Visibility mode constant for use with Ext.dom.Element.setVisibilityMode.
Use the CSS 'display' property to hide the element.
Defaults to: 2
Available since: 4.1.0
Visibility mode constant for use with Ext.dom.Element.setVisibilityMode. ...Visibility mode constant for use with Ext.dom.Element.setVisibilityMode.
Use CSS absolute positioning and top/left offsets to hide the element.
Defaults to: 3
Available since: 4.1.0
VISIBILITY : NumberstaticVisibility mode constant for use with Ext.dom.Element.setVisibilityMode. ...Visibility mode constant for use with Ext.dom.Element.setVisibilityMode.
Use the CSS 'visibility' property to hide the element.
Note that in this mode, isVisible may return true
for an element even though it actually has a parent element that is hidden. For this
reason, and in most cases, using the OFFSETS mode is a better choice.
Defaults to: 1
Available since: 4.1.0
Defined in override Ext.dom.AbstractElement_static. ...Defined in override Ext.dom.AbstractElement_static.
Defaults to: {l: 'border-left-width', r: 'border-right-width', t: 'border-top-width', b: 'border-bottom-width'}
Available since: 4.1.2
Defined in override Ext.dom.AbstractElement_static. ...Defined in override Ext.dom.AbstractElement_static.
Defaults to: /(-[a-z])/gi
Available since: 4.1.2
Defined in override Ext.dom.AbstractElement_static. ...Defined in override Ext.dom.AbstractElement_static.
Defaults to: /([a-z0-9\-]+)\s*:\s*([^;\s]+(?:\s*[^;\s]+)*);?/gi
Available since: 4.1.2
Defined in override Ext.dom.AbstractElement_static. ...Defined in override Ext.dom.AbstractElement_static.
Defaults to: {l: 'margin-left', r: 'margin-right', t: 'margin-top', b: 'margin-bottom'}
Available since: 4.1.2
Defined in override Ext.dom.AbstractElement_static. ...Defined in override Ext.dom.AbstractElement_static.
Defaults to: /alpha\(opacity=(.*)\)/i
Available since: 4.1.2
Defined in override Ext.dom.AbstractElement_static. ...Defined in override Ext.dom.AbstractElement_static.
Defaults to: {l: 'padding-left', r: 'padding-right', t: 'padding-top', b: 'padding-bottom'}
Available since: 4.1.2
propertyCache : ObjectprivatestaticDefined in override Ext.dom.AbstractElement_static. ...Defined in override Ext.dom.AbstractElement_static.
Defaults to: {}
Available since: 4.1.2
Visibility mode constant for use with Ext.dom.Element.setVisibilityMode. Add or remove the Ext.Layer.visibilityCls class to hide the element.
Defaults to: 4
Available since: 4.1.0
Visibility mode constant for use with Ext.dom.Element.setVisibilityMode. Use the CSS 'display' property to hide the element.
Defaults to: 2
Available since: 4.1.0
Visibility mode constant for use with Ext.dom.Element.setVisibilityMode. Use CSS absolute positioning and top/left offsets to hide the element.
Defaults to: 3
Available since: 4.1.0
Visibility mode constant for use with Ext.dom.Element.setVisibilityMode. Use the CSS 'visibility' property to hide the element.
Note that in this mode, isVisible may return true for an element even though it actually has a parent element that is hidden. For this reason, and in most cases, using the OFFSETS mode is a better choice.
Defaults to: 1
Available since: 4.1.0
Defined in override Ext.dom.AbstractElement_static.
Defaults to: {l: 'border-left-width', r: 'border-right-width', t: 'border-top-width', b: 'border-bottom-width'}
Available since: 4.1.2
Defined in override Ext.dom.AbstractElement_static.
Defaults to: /(-[a-z])/gi
Available since: 4.1.2
Defined in override Ext.dom.AbstractElement_static.
Defaults to: /([a-z0-9\-]+)\s*:\s*([^;\s]+(?:\s*[^;\s]+)*);?/gi
Available since: 4.1.2
Defined in override Ext.dom.AbstractElement_static.
Defaults to: {l: 'margin-left', r: 'margin-right', t: 'margin-top', b: 'margin-bottom'}
Available since: 4.1.2
Defined in override Ext.dom.AbstractElement_static.
Defaults to: /alpha\(opacity=(.*)\)/i
Available since: 4.1.2
Defined in override Ext.dom.AbstractElement_static.
Defaults to: {l: 'padding-left', r: 'padding-right', t: 'padding-top', b: 'padding-bottom'}
Available since: 4.1.2
Defined in override Ext.dom.AbstractElement_static.
Defaults to: {}
Available since: 4.1.2
Methods
Instance Methods Creates new Element directly. ...Creates new Element directly.
Available since: 1.1.0
Parameters
- element : String/HTMLElement
- forceNew : Boolean (optional)
By default the constructor checks to see if there is already an instance of this
element in the cache and if there is it returns the same instance. This will skip that check (useful for extending
this class).
Returns
Overrides: Ext.dom.AbstractElement.constructor
Adds one or more CSS classes to the element. ...Adds one or more CSS classes to the element. Duplicate classes are automatically filtered out.
Defined in override Ext.dom.AbstractElement_style.
Available since: 4.1.0
Parameters
Returns
- Ext.dom.Element
this
Sets up event handlers to add and remove a css class when the mouse is down and then up on this element (a click effe...Sets up event handlers to add and remove a css class when the mouse is down and then up on this element (a click effect)
Defined in override Ext.dom.Element_style.
Available since: 4.0.0
Parameters
- className : String
The class to add
- testFn : Function (optional)
A test function to execute before adding the class. The passed parameter
will be the Element instance. If this functions returns false, the class will not be added.
- scope : Object (optional)
The scope to execute the testFn in.
Returns
- Ext.dom.Element
this
Sets up event handlers to add and remove a css class when this element has the focus
Defined in override Ext.dom.Ele...Sets up event handlers to add and remove a css class when this element has the focus
Defined in override Ext.dom.Element_style.
Available since: 4.0.0
Parameters
- className : String
The class to add
- testFn : Function (optional)
A test function to execute before adding the class. The passed parameter
will be the Element instance. If this functions returns false, the class will not be added.
- scope : Object (optional)
The scope to execute the testFn in.
Returns
- Ext.dom.Element
this
Sets up event handlers to add and remove a css class when the mouse is over this element
Defined in override Ext.dom...Sets up event handlers to add and remove a css class when the mouse is over this element
Defined in override Ext.dom.Element_style.
Available since: 4.0.0
Parameters
- className : String
The class to add
- testFn : Function (optional)
A test function to execute before adding the class. The passed parameter
will be the Element instance. If this functions returns false, the class will not be added.
- scope : Object (optional)
The scope to execute the testFn in.
Returns
- Ext.dom.Element
this
Convenience method for constructing a KeyMap ...Convenience method for constructing a KeyMap
Available since: 1.1.0
Parameters
- key : String/Number/Number[]/Object
- fn : Function
The function to call
- scope : Object (optional)
The scope (this reference) in which the specified function is executed. Defaults to this Element.
Returns
- Ext.util.KeyMap
The KeyMap created
Creates a KeyMap for this element ...Creates a KeyMap for this element
Available since: 1.1.0
Parameters
- config : Object
The KeyMap config. See Ext.util.KeyMap for more details
Returns
- Ext.util.KeyMap
The KeyMap created
Shorthand for on. ...Shorthand for on.
Appends an event handler to this element.
Available since: 1.1.0
Parameters
- eventName : String
The name of event to handle.
- fn : Function
The handler function the event invokes. This function is passed the following parameters:
evt : EventObject
The EventObject describing the event.
el : HtmlElement
The DOM 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 call that setup the listener.
- scope : Object (optional)
The scope (this reference) in which the handler function is executed. If
omitted, defaults to this 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. If omitted, defaults to this
Element.
delegate String:
A simple selector to filter the target or look for a descendant of the target. See below for additional details.
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
target Ext.dom.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.
delay Number:
The number of milliseconds to delay the invocation of the handler after the 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.
Combining Options
Using the options argument, it is possible to combine different types of listeners:
A delayed, one-time listener that auto stops the event and adds a custom argument (forumId) to the options
object. The options object is available as the third parameter in the handler function.
Code:
el.on('click', this.onClick, this, {
single: true,
delay: 100,
stopEvent : true,
forumId: 4
});
Attaching multiple handlers in 1 call
The method also allows for a single argument to be passed which is a config object containing properties which
specify multiple handlers.
Code:
el.on({
'click' : {
fn: this.onClick,
scope: this,
delay: 100
},
'mouseover' : {
fn: this.onMouseOver,
scope: this
},
'mouseout' : {
fn: this.onMouseOut,
scope: this
}
});
Or a shorthand syntax:
Code:
el.on({
'click' : this.onClick,
'mouseover' : this.onMouseOver,
'mouseout' : this.onMouseOut,
scope: this
});
delegate
This is a configuration option that you can pass along when registering a handler for an event to assist with
event delegation. Event delegation is a technique that is used to reduce memory consumption and prevent exposure
to memory-leaks. By registering an event for a container element as opposed to each element within a container.
By setting this configuration option to a simple selector, the target element will be filtered to look for a
descendant of the target. For example:
// using this markup:
<div id='elId'>
<p id='p1'>paragraph one</p>
<p id='p2' class='clickable'>paragraph two</p>
<p id='p3'>paragraph three</p>
</div>
// utilize event delegation to registering just one handler on the container element:
el = Ext.get('elId');
el.on(
'click',
function(e,t) {
// handle click
console.info(t.id); // 'p2'
},
this,
{
// filter the target element to be a descendant with the class 'clickable'
delegate: '.clickable'
}
);
Returns
- Ext.dom.Element
this
adjustForConstraints( xy, parent )private Aligns this element with another element relative to the specified anchor points. ...Aligns this element with another element relative to the specified anchor points. If the other element is the
document it aligns it to the viewport. The position parameter is optional, and can be specified in any one of
the following formats:
- Blank: Defaults to aligning the element's top-left corner to the target's bottom-left corner ("tl-bl").
- One anchor (deprecated): The passed anchor position is used as the target element's anchor point.
The element being aligned will position its top-left corner (tl) to that point. This method has been
deprecated in favor of the newer two anchor syntax below.
- Two anchors: If two values from the table below are passed separated by a dash, the first value is used as the
element's anchor point, and the second value is used as the target's anchor point.
In addition to the anchor points, the position parameter also supports the "?" character. If "?" is passed at the end of
the position string, the element will attempt to align as specified, but the position will be adjusted to constrain to
the viewport if necessary. Note that the element being aligned might be swapped to align to a different position than
that specified in order to enforce the viewport constraints.
Following are all of the supported anchor positions:
Value Description
----- -----------------------------
tl The top left corner (default)
t The center of the top edge
tr The top right corner
l The center of the left edge
c In the center of the element
r The center of the right edge
bl The bottom left corner
b The center of the bottom edge
br The bottom right corner
Example Usage:
// align el to other-el using the default positioning ("tl-bl", non-constrained)
el.alignTo("other-el");
// align the top left corner of el with the top right corner of other-el (constrained to viewport)
el.alignTo("other-el", "tr?");
// align the bottom right corner of el with the center left edge of other-el
el.alignTo("other-el", "br-l?");
// align the center of el with the bottom left corner of other-el and
// adjust the x position by -6 pixels (and the y position by 0)
el.alignTo("other-el", "c-bl", [-6, 0]);
Defined in override Ext.dom.Element_alignment.
Available since: 1.1.0
Parameters
- element : String/HTMLElement/Ext.Element
The element to align to.
- position : String (optional)
The position to align to
Defaults to: "tl-bl?"
- offsets : Number[] (optional)
Offset the positioning by [x, y]
- animate : Boolean/Object (optional)
true for the default animation or a standard Element animation config object
Returns
- Ext.Element
this
Anchors an element to another element and realigns it when the window is resized. ...Anchors an element to another element and realigns it when the window is resized.
Defined in override Ext.dom.Element_alignment.
Available since: 1.1.0
Parameters
- element : String/HTMLElement/Ext.Element
The element to align to.
- position : String
The position to align to.
- offsets : Number[] (optional)
Offset the positioning by [x, y]
- animate : Boolean/Object (optional)
True for the default animation or a standard Element animation config object
- monitorScroll : Boolean/Number (optional)
True to monitor body scroll and reposition. If this parameter
is a number, it is used as the buffer delay (defaults to 50ms).
- callback : Function (optional)
The function to call after the animation finishes
Returns
- Ext.Element
this
anim( config )privateprocess the passed fx configuration. ...
- process the passed fx configuration.
Defined in override Ext.dom.Element_anim.
Available since: 4.1.2
Parameters
- config : Object
Performs custom animation on this Element. ...Performs custom animation on this Element.
The following properties may be specified in from, to, and keyframe objects:
x - The page X position in pixels.
y - The page Y position in pixels
left - The element's CSS left value. Units must be supplied.
top - The element's CSS top value. Units must be supplied.
width - The element's CSS width value. Units must be supplied.
height - The element's CSS height value. Units must be supplied.
scrollLeft - The element's scrollLeft value.
scrollTop - The element's scrollTop value.
opacity - The element's opacity value. This must be a value between 0 and 1.
Be aware that animating an Element which is being used by an Ext Component without in some way informing the
Component about the changed element state will result in incorrect Component behaviour. This is because the
Component will be using the old state of the element. To avoid this problem, it is now possible to directly
animate certain properties of Components.
Defined in override Ext.dom.Element_anim.
Available since: 1.1.0
Parameters
- config : Object
Configuration for Ext.fx.Anim.
Note that the to config is required.
Returns
- Ext.dom.Element
this
Appends the passed element(s) to this element
Defined in override Ext.dom.AbstractElement_insertion. ...Appends the passed element(s) to this element
Defined in override Ext.dom.AbstractElement_insertion.
Available since: 4.1.0
Parameters
- el : String/HTMLElement/Ext.dom.AbstractElement
The id of the node, a DOM Node or an existing Element.
Returns
- Ext.dom.AbstractElement
This element
Appends this element to the passed element
Defined in override Ext.dom.AbstractElement_insertion. ...Appends this element to the passed element
Defined in override Ext.dom.AbstractElement_insertion.
Available since: 4.1.0
Parameters
- el : String/HTMLElement/Ext.dom.AbstractElement
The new parent element.
The id of the node, a DOM Node or an existing Element.
Returns
- Ext.dom.AbstractElement
This element
More flexible version of setStyle for setting style properties. ...More flexible version of setStyle for setting style properties.
Defined in override Ext.dom.AbstractElement_style.
Available since: 4.1.0
Parameters
- styles : String/Object/Function
A style specification string, e.g. "width:100px", or object in the form {width:"100px"}, or
a function which returns such a specification.
Returns
- Ext.dom.Element
this
blur( ) : Ext.dom.ElementchainableTries to blur the element. ...Tries to blur the element. Any exceptions are caught and ignored.
Available since: 1.1.0
Returns
- Ext.dom.Element
this
Wraps the specified element with a special 9 element markup/CSS block that renders by default as
a gray container wit...Wraps the specified element with a special 9 element markup/CSS block that renders by default as
a gray container with a gradient background, rounded corners and a 4-way shadow.
This special markup is used throughout Ext when box wrapping elements (Ext.button.Button,
Ext.panel.Panel when frame=true, Ext.window.Window).
The markup is of this form:
Ext.dom.Element.boxMarkup =
'<div class="{0}-tl"><div class="{0}-tr"><div class="{0}-tc"></div></div></div>
<div class="{0}-ml"><div class="{0}-mr"><div class="{0}-mc"></div></div></div>
<div class="{0}-bl"><div class="{0}-br"><div class="{0}-bc"></div></div></div>';
Example usage:
// Basic box wrap
Ext.get("foo").boxWrap();
// You can also add a custom class and use CSS inheritance rules to customize the box look.
// 'x-box-blue' is a built-in alternative -- look at the related CSS definitions as an example
// for how to create a custom box wrap style.
Ext.get("foo").boxWrap().addCls("x-box-blue");
Defined in override Ext.dom.Element_style.
Available since: 1.1.0
Parameters
- class : String (optional)
A base CSS class to apply to the containing wrapper element.
Note that there are a number of CSS rules that are dependent on this name to make the overall effect work,
so if you supply an alternate base class, make sure you also supply all of the necessary rules.
Defaults to: 'x-box'
Returns
- Ext.dom.Element
The outermost wrapping element of the created box structure.
When an element is moved around in the DOM, or is hidden using display:none, it loses layout, and therefore
all scrol...When an element is moved around in the DOM, or is hidden using display:none, it loses layout, and therefore
all scroll positions of all descendant elements are lost.
This function caches them, and returns a function, which when run will restore the cached positions.
In the following example, the Panel is moved from one Container to another which will cause it to lose all scroll positions:
var restoreScroll = myPanel.el.cacheScrollValues();
myOtherContainer.add(myPanel);
restoreScroll();
Available since: 4.1.0
Returns
- Function
A function which will restore all descentant elements of this Element to their scroll
positions recorded when this function was executed. Be aware that the returned function is a closure which has
captured the scope of cacheScrollValues, so take care to derefence it as soon as not needed - if is it is a var
it will drop out of scope, and the reference will be freed.
Call the original method that was previously overridden with override
Ext.define('My.Cat', {
constructor: functi...Call the original method that was previously overridden with override
Ext.define('My.Cat', {
constructor: function() {
alert("I'm a cat!");
}
});
My.Cat.override({
constructor: function() {
alert("I'm going to be a cat!");
this.callOverridden();
alert("Meeeeoooowwww");
}
});
var kitty = new My.Cat(); // alerts "I'm going to be a cat!"
// alerts "I'm a cat!"
// alerts "Meeeeoooowwww"
This method has been deprecated
as of 4.1. Use callParent instead.
Available since: 4.0.0
Parameters
- args : Array/Arguments
The arguments, either an array or the arguments object
from the current method, for example: this.callOverridden(arguments)
Returns
- Object
Returns the result of calling the overridden method
Call the "parent" method of the current method. ...Call the "parent" method of the current method. That is the method previously
overridden by derivation or by an override (see Ext.define).
Ext.define('My.Base', {
constructor: function (x) {
this.x = x;
},
statics: {
method: function (x) {
return x;
}
}
});
Ext.define('My.Derived', {
extend: 'My.Base',
constructor: function () {
this.callParent([21]);
}
});
var obj = new My.Derived();
alert(obj.x); // alerts 21
This can be used with an override as follows:
Ext.define('My.DerivedOverride', {
override: 'My.Derived',
constructor: function (x) {
this.callParent([x*2]); // calls original My.Derived constructor
}
});
var obj = new My.Derived();
alert(obj.x); // now alerts 42
This also works with static methods.
Ext.define('My.Derived2', {
extend: 'My.Base',
statics: {
method: function (x) {
return this.callParent([x*2]); // calls My.Base.method
}
}
});
alert(My.Base.method(10); // alerts 10
alert(My.Derived2.method(10); // alerts 20
Lastly, it also works with overridden static methods.
Ext.define('My.Derived2Override', {
override: 'My.Derived2',
statics: {
method: function (x) {
return this.callParent([x*2]); // calls My.Derived2.method
}
}
});
alert(My.Derived2.method(10); // now alerts 40
To override a method and replace it and also call the superclass method, use
callSuper. This is often done to patch a method to fix a bug.
Available since: 4.0.0
Parameters
- args : Array/Arguments
The arguments, either an array or the arguments object
from the current method, for example: this.callParent(arguments)
Returns
- Object
Returns the result of calling the parent method
This method is used by an override to call the superclass method but bypass any
overridden method. ...This method is used by an override to call the superclass method but bypass any
overridden method. This is often done to "patch" a method that contains a bug
but for whatever reason cannot be fixed directly.
Consider:
Ext.define('Ext.some.Class', {
method: function () {
console.log('Good');
}
});
Ext.define('Ext.some.DerivedClass', {
method: function () {
console.log('Bad');
// ... logic but with a bug ...
this.callParent();
}
});
To patch the bug in DerivedClass.method, the typical solution is to create an
override:
Ext.define('App.paches.DerivedClass', {
override: 'Ext.some.DerivedClass',
method: function () {
console.log('Fixed');
// ... logic but with bug fixed ...
this.callSuper();
}
});
The patch method cannot use callParent to call the superclass method since
that would call the overridden method containing the bug. In other words, the
above patch would only produce "Fixed" then "Good" in the console log, whereas,
using callParent would produce "Fixed" then "Bad" then "Good".
Available since: Ext JS 4.1.3
Parameters
- args : Array/Arguments
The arguments, either an array or the arguments object
from the current method, for example: this.callSuper(arguments)
Returns
- Object
Returns the result of calling the superclass method
center( [centerIn] )Centers the Element in either the viewport, or another Element. ...Centers the Element in either the viewport, or another Element.
Defined in override Ext.dom.Element_alignment.
Available since: 1.1.0
Parameters
- centerIn : String/HTMLElement/Ext.Element (optional)
The element in which to center the element.
Selects a single direct child based on the passed CSS selector (the selector should not contain an id). ...Selects a single direct child based on the passed CSS selector (the selector should not contain an id).
Defined in override Ext.dom.AbstractElement_traversal.
Available since: 4.1.0
Parameters
- selector : String
The CSS selector
- returnDom : Boolean (optional)
True to return the DOM node instead of Ext.dom.Element.
Defaults to: false
Returns
- HTMLElement/Ext.dom.Element
The child Ext.dom.Element (or DOM node if returnDom = true)
clean( [forceReclean] )Removes Empty, or whitespace filled text nodes. ...Removes Empty, or whitespace filled text nodes. Combines adjacent text nodes.
Available since: 1.1.0
Parameters
- forceReclean : Boolean (optional)
By default the element keeps track if it has been cleaned already
so you can call this over and over. However, if you update the element and need to force a reclean, you
can pass true.
Defaults to: false
clearListeners( ) : Ext.dom.ElementchainableAlias for removeAllListeners. ...Alias for removeAllListeners.
Removes all previous added listeners from this element
Available since: 4.0.0
Returns
- Ext.dom.Element
this
clearOpacity( ) : Ext.dom.ElementchainableClears any opacity settings from this element. ...Clears any opacity settings from this element. Required in some cases for IE.
Defined in override Ext.dom.Element_style.
Available since: 1.1.0
Returns
- Ext.dom.Element
this
Clears positioning back to the default when the document was loaded. ...Clears positioning back to the default when the document was loaded.
Defined in override Ext.dom.Element_position.
Available since: 1.1.0
Parameters
- value : String (optional)
The value to use for the left, right, top, bottom. You could use 'auto'.
Defaults to: ''
Returns
clip( ) : Ext.dom.ElementchainableStore the current overflow setting and clip overflow on the element - use unclip to remove
Defined in override Ext.d...Store the current overflow setting and clip overflow on the element - use unclip to remove
Defined in override Ext.dom.Element_style.
Available since: 1.1.0
Returns
- Ext.dom.Element
this
Creates the passed DomHelper config and appends it to this element or optionally inserts it before the passed child e...Creates the passed DomHelper config and appends it to this element or optionally inserts it before the passed child element.
Defined in override Ext.dom.AbstractElement_insertion.
Available since: 4.1.0
Parameters
- config : Object
DomHelper element config object. If no tag is specified (e.g., {tag:'input'}) then a div will be
automatically generated with the specified attributes.
- insertBefore : HTMLElement (optional)
a child element of this element
- returnDom : Boolean (optional)
true to return the dom node instead of creating an Element
Defaults to: false
Returns
- Ext.dom.AbstractElement
The new child element
Creates a proxy element of this element ...Creates a proxy element of this element
Available since: 1.1.0
Parameters
- config : String/Object
The class name of the proxy element or a DomHelper config object
- renderTo : String/HTMLElement (optional)
The element or element id to render the proxy to. Defaults to: document.body.
- matchBox : Boolean (optional)
True to align and size the proxy to this element now.
Defaults to: false
Returns
- Ext.dom.Element
The new proxy element
Creates an iframe shim for this element to keep selects and other windowed objects from
showing through. ...Creates an iframe shim for this element to keep selects and other windowed objects from
showing through.
Available since: 1.1.0
Returns
- Ext.dom.Element
The new shim element
destroy( )Alias to remove. ...Alias to remove.
Removes this element's dom reference. Note that event and cache removal is handled at Ext.removeNode
Available since: 4.1.0
Overrides: Ext.Base.destroy
Selects a single child at any depth below this element based on the passed CSS selector (the selector should not cont...Selects a single child at any depth below this element based on the passed CSS selector (the selector should not contain an id).
Defined in override Ext.dom.AbstractElement_traversal.
Available since: 4.1.0
Parameters
- selector : String
The CSS selector
- returnDom : Boolean (optional)
True to return the DOM node instead of Ext.dom.Element
Defaults to: false
Returns
- HTMLElement/Ext.dom.Element
The child Ext.dom.Element (or DOM node if returnDom = true)
Convenience method for setVisibilityMode(Element.DISPLAY) ...Convenience method for setVisibilityMode(Element.DISPLAY)
Available since: 1.1.0
Parameters
- display : String (optional)
What to set display to when visible
Returns
- Ext.dom.Element
this
Fade an element in (from transparent to opaque). ...Fade an element in (from transparent to opaque). The ending opacity can be specified using the opacity
config option. Usage:
// default: fade in from opacity 0 to 100%
el.fadeIn();
// custom: fade in from opacity 0 to 75% over 2 seconds
el.fadeIn({ opacity: .75, duration: 2000});
// common config options shown with default values
el.fadeIn({
opacity: 1, //can be any value between 0 and 1 (e.g. .5)
easing: 'easeOut',
duration: 500
});
Defined in override Ext.dom.Element_anim.
Available since: 4.0.0
Parameters
- options : Object (optional)
Object literal with any of the Fx config options
Returns
- Ext.Element
The Element
Fade an element out (from opaque to transparent). ...Fade an element out (from opaque to transparent). The ending opacity can be specified using the opacity
config option. Note that IE may require useDisplay:true in order to redisplay correctly.
Usage:
// default: fade out from the element's current opacity to 0
el.fadeOut();
// custom: fade out from the element's current opacity to 25% over 2 seconds
el.fadeOut({ opacity: .25, duration: 2000});
// common config options shown with default values
el.fadeOut({
opacity: 0, //can be any value between 0 and 1 (e.g. .5)
easing: 'easeOut',
duration: 500,
remove: false,
useDisplay: false
});
Defined in override Ext.dom.Element_anim.
Available since: 4.0.0
Parameters
- options : Object (optional)
Object literal with any of the Fx config options
Returns
- Ext.Element
The Element
findParent( selector, [limit], [returnEl] ) : HTMLElementLooks at this node and then at parent nodes for a match of the passed simple selector (e.g. ...Looks at this node and then at parent nodes for a match of the passed simple selector (e.g. div.some-class or span:first-child)
Defined in override Ext.dom.AbstractElement_traversal.
Available since: 4.1.0
Parameters
- selector : String
The simple selector to test
- limit : Number/String/HTMLElement/Ext.Element (optional)
The max depth to search as a number or an element which causes the upward traversal to stop
and is not considered for inclusion as the result. (defaults to 50 || document.documentElement)
- returnEl : Boolean (optional)
True to return a Ext.Element object instead of DOM node
Defaults to: false
Returns
- HTMLElement
The matching DOM node (or null if no match was found)
findParentNode( selector, [limit], [returnEl] ) : HTMLElementLooks at parent nodes for a match of the passed simple selector (e.g. ...Looks at parent nodes for a match of the passed simple selector (e.g. div.some-class or span:first-child)
Defined in override Ext.dom.AbstractElement_traversal.
Available since: 4.1.0
Parameters
- selector : String
The simple selector to test
- limit : Number/String/HTMLElement/Ext.Element (optional)
The max depth to search as a number or an element which causes the upward traversal to stop
and is not considered for inclusion as the result. (defaults to 50 || document.documentElement)
- returnEl : Boolean (optional)
True to return a Ext.Element object instead of DOM node
Defaults to: false
Returns
- HTMLElement
The matching DOM node (or null if no match was found)
Gets the first child, skipping text nodes
Defined in override Ext.dom.AbstractElement_traversal. ...Gets the first child, skipping text nodes
Defined in override Ext.dom.AbstractElement_traversal.
Available since: 4.1.0
Parameters
- selector : String (optional)
Find the next sibling that matches the passed simple selector
- returnDom : Boolean (optional)
True to return a raw dom node instead of an Ext.dom.Element
Defaults to: false
Returns
- Ext.dom.Element/HTMLElement
The first child or null
Tries to focus the element. ...Tries to focus the element. Any exceptions are caught and ignored.
Available since: 1.1.0
Parameters
- defer : Number (optional)
Milliseconds to defer the focus
Returns
- Ext.dom.Element
this
Alias for isFocusable. ...Alias for isFocusable.
Checks whether this element can be focused.
Available since: 4.0.7
Parameters
- asFocusEl : Object
Returns
- Boolean
True if the element is focusable
Shows a ripple of exploding, attenuating borders to draw attention to an Element. ...Shows a ripple of exploding, attenuating borders to draw attention to an Element. Usage:
// default: a single light blue ripple
el.frame();
// custom: 3 red ripples lasting 3 seconds total
el.frame("#ff0000", 3, { duration: 3000 });
// common config options shown with default values
el.frame("#C3DAF9", 1, {
duration: 1000 // duration of each individual ripple.
// Note: Easing is not configurable and will be ignored if included
});
Defined in override Ext.dom.Element_anim.
Available since: 4.0.0
Parameters
- color : String (optional)
The hex color value for the border.
Defaults to: '#C3DAF9'
- count : Number (optional)
The number of ripples to display.
Defaults to: 1
- options : Object (optional)
Object literal with any of the Fx config options
Returns
- Ext.dom.Element
The Element
getActiveElement( ) : HTMLElementReturns the active element in the DOM. ...Returns the active element in the DOM. If the browser supports activeElement
on the document, this is returned. If not, the focus is tracked and the active
element is maintained internally.
Defined in override Ext.dom.AbstractElement_static.
Available since: 4.1.0
Returns
- HTMLElement
The active (focused) element in the document.
Gets the x,y coordinates to align this element with another element. ...Gets the x,y coordinates to align this element with another element. See alignTo for more info on the
supported position values.
Defined in override Ext.dom.Element_alignment.
Available since: 1.1.0
Parameters
- element : String/HTMLElement/Ext.Element
The element to align to.
- position : String (optional)
The position to align to (defaults to )
Defaults to: "tl-bl?"
- offsets : Number[] (optional)
Offset the positioning by [x, y]
Returns
- Number[]
[x, y]
Overrides: Ext.dom.AbstractElement.getAlignToXY
getAnchor( )privateprivate
Defined in override Ext.dom.AbstractElement_alignment. ...private
Defined in override Ext.dom.AbstractElement_alignment.
Available since: 4.1.2
Gets the x,y coordinates specified by the anchor position on the element. ...Gets the x,y coordinates specified by the anchor position on the element.
Defined in override Ext.dom.Element_alignment.
Available since: 1.1.0
Parameters
- anchor : String (optional)
The specified anchor position. See alignTo
for details on supported anchor positions.
Defaults to: 'c'
- local : Boolean (optional)
True to get the local (element top/left-relative) anchor position instead
of page coordinates
- size : Object (optional)
An object containing the size to use for calculating anchor position
{width: (target width), height: (target height)} (defaults to the element's current size)
Returns
- Number[]
[x, y] An array containing the element's x and y coordinates
Overrides: Ext.dom.AbstractElement.getAnchorXY
Gets the width of the border(s) for the specified side(s)
Defined in override Ext.dom.AbstractElement_style. ...Gets the width of the border(s) for the specified side(s)
Defined in override Ext.dom.AbstractElement_style.
Available since: 4.1.0
Parameters
- side : String
Can be t, l, r, b or any combination of those to add multiple values. For example,
passing 'lr' would get the border left width + the border right width.
Returns
- Number
The width of the sides passed added together
Gets the bottom Y coordinate of the element (element Y position + element height)
Defined in override Ext.dom.Abstra... Return an object defining the area of this Element which can be passed to setBox to
set another Element's size/locati...Return an object defining the area of this Element which can be passed to setBox to
set another Element's size/location to match this element.
Defined in override Ext.dom.AbstractElement_position.
Available since: 4.1.0
Parameters
- contentBox : Boolean (optional)
If true a box for the content of the element is returned.
- local : Boolean (optional)
If true the element's left and top are returned instead of page x/y.
Returns
- Object
box An object in the format:
{
x: <Element's X position>,
y: <Element's Y position>,
width: <Element's width>,
height: <Element's height>,
bottom: <Element's lower bound>,
right: <Element's rightmost bound>
}
The returned object may also be addressed as an Array where index 0 contains the X position
and index 1 contains the Y position. So the result may also be used for setXY
getCenterXY( ) : Number[]Calculates the x, y to center this element on the screen
Defined in override Ext.dom.Element_alignment. ...Calculates the x, y to center this element on the screen
Defined in override Ext.dom.Element_alignment.
Available since: 1.1.0
Returns
- Number[]
The x, y values [x, y]
getColor( attr, defaultValue, [prefix] )Return the CSS color for the specified CSS attribute. ...Return the CSS color for the specified CSS attribute. rgb, 3 digit (like #fff) and valid values
are convert to standard 6 digit hex color.
Defined in override Ext.dom.Element_style.
Available since: 1.1.0
Parameters
getComputedHeight( ) : NumberReturns either the offsetHeight or the height of this element based on CSS height adjusted by padding or borders
when...Returns either the offsetHeight or the height of this element based on CSS height adjusted by padding or borders
when needed to simulate offsetHeight when offsets aren't available. This may not work on display:none elements
if a height has not been set using CSS.
Defined in override Ext.dom.Element_style.
Available since: 1.1.0
Returns
getComputedWidth( ) : NumberReturns either the offsetWidth or the width of this element based on CSS width adjusted by padding or borders
when ne...Returns either the offsetWidth or the width of this element based on CSS width adjusted by padding or borders
when needed to simulate offsetWidth when offsets aren't available. This may not work on display:none elements
if a width has not been set using CSS.
Defined in override Ext.dom.Element_style.
Available since: 1.1.0
Returns
Returns the [X, Y] vector by which this element must be translated to make a best attempt
to constrain within the pas...Returns the [X, Y] vector by which this element must be translated to make a best attempt
to constrain within the passed constraint. Returns false is this element does not need to be moved.
Priority is given to constraining the top and left within the constraint.
The constraint may either be an existing element into which this element is to be constrained, or
an Region into which this element is to be constrained.
Defined in override Ext.dom.Element_alignment.
Available since: 4.0.0
Parameters
- constrainTo : Ext.Element/Ext.util.Region
The Element or Region into which this element is to be constrained.
- proposedPosition : Number[]
A proposed [X, Y] position to test for validity and to produce a vector for instead
of using this Element's current position;
Returns
getHTML( )Returns the innerHTML of an Element or an empty string if the element's
dom no longer exists. ...Returns the innerHTML of an Element or an empty string if the element's
dom no longer exists.
Available since: 4.1.0
Returns the x-coordinate of this element relative to its offsetParent. ...Returns the x-coordinate of this element relative to its offsetParent.
Defined in override Ext.dom.Element_position.
Available since: 4.1.1
Returns
- Number
The local x-coordinate (relative to the offsetParent).
Returns the y-coordinate of this element relative to its offsetParent. ...Returns the y-coordinate of this element relative to its offsetParent.
Defined in override Ext.dom.Element_position.
Available since: 4.1.1
Returns
- Number
The local y-coordinate (relative to the offsetParent).
Returns an object with properties top, left, right and bottom representing the margins of this element unless sides i...Returns an object with properties top, left, right and bottom representing the margins of this element unless sides is passed,
then it returns the calculated width of the sides (see getPadding)
Defined in override Ext.dom.AbstractElement_style.
Available since: 4.1.0
Parameters
- sides : String (optional)
Any combination of l, r, t, b to get the sum of those sides
Returns
Returns the offsets of this element from the passed element. ...Returns the offsets of this element from the passed element. Both element must be part
of the DOM tree and not have display:none to have page coordinates.
Defined in override Ext.dom.Element_position.
Available since: 2.3.0
Parameters
- element : String/HTMLElement/Ext.Element
The element to get the offsets from.
Returns
- Number[]
The XY page offsets (e.g. [100, -200])
Overrides: Ext.dom.AbstractElement.getOffsetsTo
Gets the width of the padding(s) for the specified side(s)
Defined in override Ext.dom.AbstractElement_style. ...Gets the width of the padding(s) for the specified side(s)
Defined in override Ext.dom.AbstractElement_style.
Available since: 4.1.0
Parameters
- side : String
Can be t, l, r, b or any combination of those to add multiple values. For example,
passing 'lr' would get the padding left + the padding right.
Returns
- Number
The padding of the sides passed added together
Return an object defining the area of this Element which can be passed to setBox to
set another Element's size/locati...Return an object defining the area of this Element which can be passed to setBox to
set another Element's size/location to match this element.
Defined in override Ext.dom.AbstractElement_position.
Available since: 4.1.0
Parameters
- asRegion : Boolean (optional)
If true an Ext.util.Region will be returned
Returns
- Object
box An object in the format
{
left: <Element's X position>,
top: <Element's Y position>,
width: <Element's width>,
height: <Element's height>,
bottom: <Element's lower bound>,
right: <Element's rightmost bound>
}
The returned object may also be addressed as an Array where index 0 contains the X position
and index 1 contains the Y position. So the result may also be used for setXY
getPositioning( ) : ObjectGets an object with all CSS positioning properties. ...Gets an object with all CSS positioning properties. Useful along with #setPostioning to get
snapshot before performing an update and then restoring the element.
Defined in override Ext.dom.Element_position.
Available since: 1.1.0
Returns
getRegion( ) : Ext.util.RegionReturns the region of this element. ...Returns the region of this element.
The element must be part of the DOM tree to have a region
(display:none or elements not appended return false).
Defined in override Ext.dom.Element_position.
Available since: 1.1.0
Returns
- Ext.util.Region
A Region containing "top, left, bottom, right" member data.
Gets the right X coordinate of the element (element X position + element width)
Defined in override Ext.dom.Abstract... getRightMarginFixCleaner( target )privateCreates a function to call to clean up problems with the work-around for the
WebKit RightMargin bug. ...Creates a function to call to clean up problems with the work-around for the
WebKit RightMargin bug. The work-around is to add "display: 'inline-block'" to
the element before calling getComputedStyle and then to restore its original
display value. The problem with this is that it corrupts the selection of an
INPUT or TEXTAREA element (as in the "I-beam" goes away but ths focus remains).
To cleanup after this, we need to capture the selection of any such element and
then restore it after we have restored the display style.
Defined in override Ext.dom.AbstractElement_static.
Available since: 4.1.0
Parameters
- target : Ext.dom.Element
The top-most element being adjusted.
getScopeParent( ) : HTMLElementprotectedGets the parent node of the current element taking into account Ext.scopeResetCSS ...Gets the parent node of the current element taking into account Ext.scopeResetCSS
Available since: 4.0.6
Returns
- HTMLElement
The parent element
Returns the current scroll position of the element. ...Returns the current scroll position of the element.
Defined in override Ext.dom.Element_scroll.
Available since: 1.1.0
Returns
- Object
An object containing the scroll position in the format
{left: (scrollLeft), top: (scrollTop)}
Returns a named style property based on computed/currentStyle (primary) and
inline-style if primary is not available. ...Returns a named style property based on computed/currentStyle (primary) and
inline-style if primary is not available.
Defined in override Ext.dom.AbstractElement_style.
Available since: 4.1.0
Parameters
- property : String/String[]
The style property (or multiple property names
in an array) whose value is returned.
- inline : Boolean (optional)
if true only inline styles will be returned.
Defaults to: false
Returns
getStyleSize( ) : ObjectReturns the dimensions of the element available to lay content out in. ...Returns the dimensions of the element available to lay content out in.
getStyleSize utilizes prefers style sizing if present, otherwise it chooses the larger of offsetHeight/clientHeight and
offsetWidth/clientWidth. To obtain the size excluding scrollbars, use getViewSize.
Sizing of the document body is handled at the adapter level which handles special cases for IE and strict modes, etc.
Defined in override Ext.dom.Element_style.
Available since: 3.4.0
Returns
Returns the width in pixels of the passed text, or the width of the text in this Element. ...Returns the width in pixels of the passed text, or the width of the text in this Element.
Available since: 2.3.0
Parameters
- text : String
The text to measure. Defaults to the innerHTML of the element.
- min : Number (optional)
The minumum value to return.
- max : Number (optional)
The maximum value to return.
Returns
- Number
The text width in pixels.
Returns the content region of this element. ...Returns the content region of this element. That is the region within the borders and padding.
Defined in override Ext.dom.Element_position.
Available since: 4.0.0
Returns
- Ext.util.Region
A Region containing "top, left, bottom, right" member data.
getViewSize( ) : ObjectReturns the dimensions of the element available to lay content out in. ...Returns the dimensions of the element available to lay content out in.
If the element (or any ancestor element) has CSS style display: none, the dimensions will be zero.
Example:
var vpSize = Ext.getBody().getViewSize();
// all Windows created afterwards will have a default value of 90% height and 95% width
Ext.Window.override({
width: vpSize.width * 0.9,
height: vpSize.height * 0.95
});
// To handle window resizing you would have to hook onto onWindowResize.
getViewSize utilizes clientHeight/clientWidth which excludes sizing of scrollbars.
To obtain the size including scrollbars, use getStyleSize
Sizing of the document body is handled at the adapter level which handles special cases for IE and strict modes, etc.
Defined in override Ext.dom.AbstractElement_style.
Available since: 4.1.0
Returns
Gets the current X position of the element based on page coordinates. ...Gets the current X position of the element based on page coordinates. Element must be part of the DOM
tree to have page coordinates (display:none or elements not appended return false).
Defined in override Ext.dom.AbstractElement_position.
Available since: 4.1.0
Parameters
- el : Object
Returns
- Number
The X position of the element
Gets the current position of the element based on page coordinates. ...Gets the current position of the element based on page coordinates.
Element must be part of the DOM tree to have page coordinates
(display:none or elements not appended return false).
Defined in override Ext.dom.Element_position.
Available since: 1.1.0
Returns
- Number[]
The XY position of the element
Overrides: Ext.dom.AbstractElement.getXY
Gets the current Y position of the element based on page coordinates. ...Gets the current Y position of the element based on page coordinates. Element must be part of the DOM
tree to have page coordinates (display:none or elements not appended return false).
Defined in override Ext.dom.AbstractElement_position.
Available since: 4.1.0
Parameters
- el : Object
Returns
- Number
The Y position of the element
Slides the element while fading it out of view. ...Slides the element while fading it out of view. An anchor point can be optionally passed to set the ending point
of the effect. Usage:
// default: slide the element downward while fading out
el.ghost();
// custom: slide the element out to the right with a 2-second duration
el.ghost('r', { duration: 2000 });
// common config options shown with default values
el.ghost('b', {
easing: 'easeOut',
duration: 500
});
Defined in override Ext.dom.Element_anim.
Available since: 4.0.0
Parameters
- anchor : String (optional)
One of the valid Fx anchor positions (defaults to bottom: 'b')
- options : Object (optional)
Object literal with any of the Fx config options
Returns
- Ext.dom.Element
The Element
hasMetrics( )privateDetermine if the Element has a relevant height and width available based
upon current logical visibility state
Defin...Determine if the Element has a relevant height and width available based
upon current logical visibility state
Defined in override Ext.dom.Element_fx.
Available since: 3.4.0
Hide this element - Uses display mode to determine whether to use "display" or "visibility". ...Hide this element - Uses display mode to determine whether to use "display" or "visibility". See setVisible.
Defined in override Ext.dom.Element_fx.
Available since: 1.1.0
Parameters
- animate : Boolean/Object (optional)
true for the default animation or a standard Element animation config object
Returns
- Ext.dom.Element
this
Overrides: Ext.dom.AbstractElement.hide
Highlights the Element by setting a color (applies to the background-color by default, but can be changed using
the "...Highlights the Element by setting a color (applies to the background-color by default, but can be changed using
the "attr" config option) and then fading back to the original color. If no original color is available, you
should provide the "endColor" config option which will be cleared after the animation. Usage:
// default: highlight background to yellow
el.highlight();
// custom: highlight foreground text to blue for 2 seconds
el.highlight("0000ff", { attr: 'color', duration: 2000 });
// common config options shown with default values
el.highlight("ffff9c", {
attr: "backgroundColor", //can be any valid CSS property (attribute) that supports a color value
endColor: (current color) or "ffffff",
easing: 'easeIn',
duration: 1000
});
Defined in override Ext.dom.Element_anim.
Available since: 4.0.0
Parameters
- color : String (optional)
The highlight color. Should be a 6 char hex color without the leading #
(defaults to yellow: 'ffff9c')
- options : Object (optional)
Object literal with any of the Fx config options
Returns
- Ext.dom.Element
The Element
Sets up event handlers to call the passed functions when the mouse is moved into and out of the Element. ...Sets up event handlers to call the passed functions when the mouse is moved into and out of the Element.
Available since: 2.3.0
Parameters
- overFn : Function
The function to call when the mouse enters the Element.
- outFn : Function
The function to call when the mouse leaves the Element.
- scope : Object (optional)
The scope (this reference) in which the functions are executed. Defaults
to the Element's DOM element.
- options : Object (optional)
Options for the listener. See the
options parameter.
Returns
- Ext.dom.Element
this
Initialize configuration for this class. ...Initialize configuration for this class. a typical example:
Ext.define('My.awesome.Class', {
// The default config
config: {
name: 'Awesome',
isAwesome: true
},
constructor: function(config) {
this.initConfig(config);
}
});
var awesome = new My.awesome.Class({
name: 'Super Awesome'
});
alert(awesome.getName()); // 'Super Awesome'
Available since: 4.0.0
Parameters
- config : Object
Returns
- Ext.Base
this
Initializes a Ext.dd.DD drag drop object for this element. ...Initializes a Ext.dd.DD drag drop object for this element.
Defined in override Ext.dom.Element_dd.
Available since: 1.1.0
Parameters
- group : String
The group the DD object is member of
- config : Object
The DD config object
- overrides : Object
An object containing methods to override/implement on the DD object
Returns
- Ext.dd.DD
The DD object
Initializes a Ext.dd.DDProxy object for this element. ...Initializes a Ext.dd.DDProxy object for this element.
Defined in override Ext.dom.Element_dd.
Available since: 1.1.0
Parameters
- group : String
The group the DDProxy object is member of
- config : Object
The DDProxy config object
- overrides : Object
An object containing methods to override/implement on the DDProxy object
Returns
- Ext.dd.DDProxy
The DDProxy object
Initializes a Ext.dd.DDTarget object for this element. ...Initializes a Ext.dd.DDTarget object for this element.
Defined in override Ext.dom.Element_dd.
Available since: 1.1.0
Parameters
- group : String
The group the DDTarget object is member of
- config : Object
The DDTarget config object
- overrides : Object
An object containing methods to override/implement on the DDTarget object
Returns
- Ext.dd.DDTarget
The DDTarget object
Inserts this element after the passed element in the DOM
Defined in override Ext.dom.AbstractElement_insertion. ...Inserts this element after the passed element in the DOM
Defined in override Ext.dom.AbstractElement_insertion.
Available since: 4.1.0
Parameters
- el : String/HTMLElement/Ext.dom.AbstractElement
The element to insert after.
The id of the node, a DOM Node or an existing Element.
Returns
- Ext.dom.AbstractElement
This element
Inserts this element before the passed element in the DOM
Defined in override Ext.dom.AbstractElement_insertion. ...Inserts this element before the passed element in the DOM
Defined in override Ext.dom.AbstractElement_insertion.
Available since: 4.1.0
Parameters
- el : String/HTMLElement/Ext.dom.AbstractElement
The element before which this element will be inserted.
The id of the node, a DOM Node or an existing Element.
Returns
- Ext.dom.AbstractElement
This element
Inserts (or creates) an element (or DomHelper config) as the first child of this element
Defined in override Ext.dom...Inserts (or creates) an element (or DomHelper config) as the first child of this element
Defined in override Ext.dom.AbstractElement_insertion.
Available since: 4.1.0
Parameters
- el : String/HTMLElement/Ext.dom.AbstractElement/Object
The id or element to insert or a DomHelper config
to create and insert
Returns
- Ext.dom.AbstractElement
The new child
Inserts an html fragment into this element
Defined in override Ext.dom.AbstractElement_insertion. ...Inserts an html fragment into this element
Defined in override Ext.dom.AbstractElement_insertion.
Available since: 4.1.0
Parameters
- where : String
Where to insert the html in relation to this element - beforeBegin, afterBegin, beforeEnd, afterEnd.
See Ext.dom.Helper.insertHtml for details.
- html : String
The HTML fragment
- returnEl : Boolean (optional)
True to return an Ext.dom.AbstractElement
Defaults to: false
Returns
- HTMLElement/Ext.dom.AbstractElement
The inserted node (or nearest related if more than 1 inserted)
Inserts (or creates) the passed element (or DomHelper config) as a sibling of this element
Defined in override Ext.d...Inserts (or creates) the passed element (or DomHelper config) as a sibling of this element
Defined in override Ext.dom.AbstractElement_insertion.
Available since: 4.1.0
Parameters
- el : String/HTMLElement/Ext.dom.AbstractElement/Object/Array
The id, element to insert or a DomHelper config
to create and insert or an array of any of those.
- where : String (optional)
'before' or 'after'
Defaults to: 'before'
- returnDom : Boolean (optional)
True to return the .;ll;l,raw DOM element instead of Ext.dom.AbstractElement
Defaults to: false
Returns
- Ext.dom.AbstractElement
The inserted Element. If an array is passed, the last inserted element is returned.
isAncestor( element )privateDefined in override Ext.dom.AbstractElement_traversal. ...Defined in override Ext.dom.AbstractElement_traversal.
Available since: 4.1.2
Parameters
- element : Object
isBorderBox( ) : BooleanTests various css rules/browsers to determine if this element uses a border box ...Tests various css rules/browsers to determine if this element uses a border box
Available since: 1.1.0
Returns
Returns true if this element is masked. ...Returns true if this element is masked. Also re-centers any displayed message within the mask.
Available since: 1.1.0
Returns
isScrollable( ) : BooleanReturns true if this element is scrollable. ...Returns true if this element is scrollable.
Defined in override Ext.dom.Element_scroll.
Available since: 1.1.0
Returns
Returns true if the value of the given property is visually transparent. ...Returns true if the value of the given property is visually transparent. This
may be due to a 'transparent' style value or an rgba value with 0 in the alpha
component.
Defined in override Ext.dom.AbstractElement_style.
Available since: 4.1.0
Parameters
- prop : String
The style property whose value is to be tested.
Returns
- Boolean
True if the style property is visually transparent.
Checks whether the element is currently visible using both visibility and display properties. ...Checks whether the element is currently visible using both visibility and display properties.
Available since: 1.1.0
Parameters
- deep : Boolean (optional)
True to walk the dom and see if parent elements are hidden.
If false, the function only checks the visibility of the element itself and it may return
true even though a parent is not visible.
Defaults to: false
Returns
- Boolean
true if the element is currently visible, else false
Gets the last child, skipping text nodes
Defined in override Ext.dom.AbstractElement_traversal. ...Gets the last child, skipping text nodes
Defined in override Ext.dom.AbstractElement_traversal.
Available since: 4.1.0
Parameters
- selector : String (optional)
Find the previous sibling that matches the passed simple selector
- returnDom : Boolean (optional)
True to return a raw dom node instead of an Ext.dom.Element
Defaults to: false
Returns
- Ext.dom.Element/HTMLElement
The last child or null
Direct access to the Ext.ElementLoader Ext.ElementLoader.load method. ...Direct access to the Ext.ElementLoader Ext.ElementLoader.load method. The method takes the same object
parameter as Ext.ElementLoader.load
Available since: 1.1.0
Parameters
- options : Object
Returns
- Ext.dom.Element
this
Puts a mask over this element to disable user interaction. ...Puts a mask over this element to disable user interaction. Requires core.css.
This method can only be applied to elements which accept child nodes.
Available since: 1.1.0
Parameters
- msg : String (optional)
A message to display in the mask
- msgCls : String (optional)
A css class to apply to the msg element
Returns
- Ext.dom.Element
The mask element
Overrides: Ext.dom.AbstractElement.mask
matchNode( dir, start, selector, returnDom )private Monitors this Element for the mouse leaving. ...Monitors this Element for the mouse leaving. Calls the function after the specified delay only if
the mouse was not moved back into the Element within the delay. If the mouse was moved
back in, the function is not called.
Available since: 4.0.0
Parameters
- delay : Number
The delay in milliseconds to wait for possible mouse re-entry before calling the handler function.
- handler : Function
The function to call if the mouse remains outside of this Element for the specified time.
- scope : Object (optional)
The scope (this reference) in which the handler function executes. Defaults to this Element.
Returns
- Object
The listeners object which was added to this element so that monitoring can be stopped. Example usage:
// Hide the menu if the mouse moves out for 250ms or more
this.mouseLeaveMonitor = this.menuEl.monitorMouseLeave(250, this.hideMenu, this);
...
// Remove mouseleave monitor on menu destroy
this.menuEl.un(this.mouseLeaveMonitor);
move( direction, distance, [animate] )Move this element relative to its current position. ...Move this element relative to its current position.
Defined in override Ext.dom.Element_position.
Available since: 1.1.0
Parameters
Sets the position of the element in page coordinates, regardless of how the element
is positioned. ...Sets the position of the element in page coordinates, regardless of how the element
is positioned. The element must be part of the DOM tree to have page coordinates
(display:none or elements not appended return false).
Defined in override Ext.dom.Element_position.
Available since: 1.1.0
Parameters
- x : Number
X value for new position (coordinates are page-based)
- y : Number
Y value for new position (coordinates are page-based)
- animate : Boolean/Object (optional)
True for the default animation, or a standard Element
animation config object
Returns
Returns true if this element needs an explicit tabIndex to make it focusable. ...Returns true if this element needs an explicit tabIndex to make it focusable. Input fields, text areas, buttons
anchors elements with an href etc do not need a tabIndex, but structural elements do.
Available since: 4.1.0
Gets the next sibling, skipping text nodes
Defined in override Ext.dom.AbstractElement_traversal. ...Gets the next sibling, skipping text nodes
Defined in override Ext.dom.AbstractElement_traversal.
Available since: 4.1.0
Parameters
- selector : String (optional)
Find the next sibling that matches the passed simple selector
- returnDom : Boolean (optional)
True to return a raw dom node instead of an Ext.dom.Element
Defaults to: false
Returns
- Ext.dom.Element/HTMLElement
The next sibling or null
Appends an event handler to this element. ...Appends an event handler to this element.
Available since: 1.1.0
Parameters
- eventName : String
The name of event to handle.
- fn : Function
The handler function the event invokes. This function is passed the following parameters:
evt : EventObject
The EventObject describing the event.
el : HtmlElement
The DOM 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 call that setup the listener.
- scope : Object (optional)
The scope (this reference) in which the handler function is executed. If
omitted, defaults to this 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. If omitted, defaults to this
Element.
delegate String:
A simple selector to filter the target or look for a descendant of the target. See below for additional details.
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
target Ext.dom.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.
delay Number:
The number of milliseconds to delay the invocation of the handler after the 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.
Combining Options
Using the options argument, it is possible to combine different types of listeners:
A delayed, one-time listener that auto stops the event and adds a custom argument (forumId) to the options
object. The options object is available as the third parameter in the handler function.
Code:
el.on('click', this.onClick, this, {
single: true,
delay: 100,
stopEvent : true,
forumId: 4
});
Attaching multiple handlers in 1 call
The method also allows for a single argument to be passed which is a config object containing properties which
specify multiple handlers.
Code:
el.on({
'click' : {
fn: this.onClick,
scope: this,
delay: 100
},
'mouseover' : {
fn: this.onMouseOver,
scope: this
},
'mouseout' : {
fn: this.onMouseOut,
scope: this
}
});
Or a shorthand syntax:
Code:
el.on({
'click' : this.onClick,
'mouseover' : this.onMouseOver,
'mouseout' : this.onMouseOut,
scope: this
});
delegate
This is a configuration option that you can pass along when registering a handler for an event to assist with
event delegation. Event delegation is a technique that is used to reduce memory consumption and prevent exposure
to memory-leaks. By registering an event for a container element as opposed to each element within a container.
By setting this configuration option to a simple selector, the target element will be filtered to look for a
descendant of the target. For example:
// using this markup:
<div id='elId'>
<p id='p1'>paragraph one</p>
<p id='p2' class='clickable'>paragraph two</p>
<p id='p3'>paragraph three</p>
</div>
// utilize event delegation to registering just one handler on the container element:
el = Ext.get('elId');
el.on(
'click',
function(e,t) {
// handle click
console.info(t.id); // 'p2'
},
this,
{
// filter the target element to be a descendant with the class 'clickable'
delegate: '.clickable'
}
);
Returns
- Ext.dom.Element
this
onConfigUpdate( names, callback, scope )private Gets the parent node for this element, optionally chaining up trying to match a selector
Defined in override Ext.dom...Gets the parent node for this element, optionally chaining up trying to match a selector
Defined in override Ext.dom.AbstractElement_traversal.
Available since: 4.1.0
Parameters
- selector : String (optional)
Find a parent node that matches the passed simple selector
- returnDom : Boolean (optional)
True to return a raw dom node instead of an Ext.dom.Element
Defaults to: false
Returns
- Ext.dom.Element/HTMLElement
The parent node or null
Creates a pause before any subsequent queued effects begin. ...Creates a pause before any subsequent queued effects begin. If there are no effects queued after the pause it will
have no effect. Usage:
el.pause(1);
Defined in override Ext.dom.Element_anim.
This method has been deprecated since 4.0
Use the delay config to animate instead.
Available since: 4.0.0
Parameters
- seconds : Number
The length of time to pause (in seconds)
Returns
- Ext.Element
The Element
populateStyleMap( map, order )Creates mappings for 'margin-before' to 'marginLeft' (etc.) given the output
map and an ordering pair (e.g., ['left',... position( [pos], [zIndex], [x], [y] )Initializes positioning on this element. ...Initializes positioning on this element. If a desired position is not passed, it will make the
the element positioned relative IF it is not already positioned.
Defined in override Ext.dom.Element_position.
Available since: 1.1.0
Parameters
Gets the previous sibling, skipping text nodes
Defined in override Ext.dom.AbstractElement_traversal. ...Gets the previous sibling, skipping text nodes
Defined in override Ext.dom.AbstractElement_traversal.
Available since: 4.1.0
Parameters
- selector : String (optional)
Find the previous sibling that matches the passed simple selector
- returnDom : Boolean (optional)
True to return a raw dom node instead of an Ext.dom.Element
Defaults to: false
Returns
- Ext.dom.Element/HTMLElement
The previous sibling or null
Fades the element out while slowly expanding it in all directions. ...Fades the element out while slowly expanding it in all directions. When the effect is completed, the element will
be hidden (visibility = 'hidden') but block elements will still take up space in the document. Usage:
// default
el.puff();
// common config options shown with default values
el.puff({
easing: 'easeOut',
duration: 500,
useDisplay: false
});
Defined in override Ext.dom.Element_anim.
Available since: 4.0.0
Parameters
- options : Object (optional)
Object literal with any of the Fx config options
Returns
- Ext.dom.Element
The Element
purgeAllListeners( ) : Ext.dom.ElementchainableRecursively removes all previous added listeners from this element and its children ...Recursively removes all previous added listeners from this element and its children
Available since: 3.4.0
Returns
- Ext.dom.Element
this
query( selector ) : HTMLElement[]Selects child nodes based on the passed CSS selector (the selector should not contain an id). ...Selects child nodes based on the passed CSS selector (the selector should not contain an id).
Defined in override Ext.dom.AbstractElement_traversal.
Available since: 4.1.0
Parameters
- selector : String
The CSS selector
Returns
- HTMLElement[]
An array of the matched nodes
Adds one or more CSS classes to this element and removes the same class(es) from all siblings. ...Adds one or more CSS classes to this element and removes the same class(es) from all siblings.
Defined in override Ext.dom.AbstractElement_style.
Available since: 4.1.0
Parameters
Returns
- Ext.dom.Element
this
relayEvent( eventName, observable )Create an event handler on this element such that when the event fires and is handled by this element,
it will be rel...Create an event handler on this element such that when the event fires and is handled by this element,
it will be relayed to another object (i.e., fired again as if it originated from that object instead).
Available since: 1.1.0
Parameters
- eventName : String
The type of event to relay
- observable : Object
Any object that extends Ext.util.Observable that will provide the context
for firing the relayed event
remove( )Removes this element's dom reference. ...Removes this element's dom reference. Note that event and cache removal is handled at Ext.removeNode
Available since: 4.1.0
removeAllListeners( ) : Ext.dom.ElementchainableRemoves all previous added listeners from this element ...Removes all previous added listeners from this element
Available since: 1.1.0
Returns
- Ext.dom.Element
this
removeAnchor( ) : Ext.dom.ElementchainableRemove any anchor to this element. ...Remove any anchor to this element. See anchorTo.
Defined in override Ext.dom.Element_alignment.
Available since: 3.4.0
Returns
- Ext.dom.Element
this
Removes one or more CSS classes from the element. ...Removes one or more CSS classes from the element.
Defined in override Ext.dom.AbstractElement_style.
Available since: 4.1.0
Parameters
Returns
- Ext.dom.Element
this
Shorthand for un. ...Shorthand for un.
Removes an event handler from this element.
Note: if a scope was explicitly specified when adding the listener,
the same scope must be specified here.
Example:
el.un('click', this.handlerFn);
// or
el.removeListener('click', this.handlerFn);
Available since: 1.1.0
Parameters
- eventName : String
The name of the event from which to remove the handler.
- fn : Function
The handler function to remove. This must be a reference to the function passed into the
on call.
- scope : Object
If a scope (this reference) was specified when the listener was added, then this must
refer to the same object.
Returns
- Ext.dom.Element
this
repaint( ) : Ext.dom.ElementchainableForces the browser to repaint this element
Defined in override Ext.dom.AbstractElement_style. ...Forces the browser to repaint this element
Defined in override Ext.dom.AbstractElement_style.
Available since: 4.1.0
Returns
- Ext.dom.Element
this
Replaces the passed element with this element
Defined in override Ext.dom.AbstractElement_insertion. ...Replaces the passed element with this element
Defined in override Ext.dom.AbstractElement_insertion.
Available since: 4.1.0
Parameters
- el : String/HTMLElement/Ext.dom.AbstractElement
The element to replace.
The id of the node, a DOM Node or an existing Element.
Returns
- Ext.dom.AbstractElement
This element
Replaces a CSS class on the element with another. ...Replaces a CSS class on the element with another. If the old name does not exist, the new name will simply be added.
Defined in override Ext.dom.AbstractElement_style.
Available since: 4.1.0
Parameters
Returns
- Ext.dom.Element
this
Replaces this element with the passed element
Defined in override Ext.dom.AbstractElement_insertion. ...Replaces this element with the passed element
Defined in override Ext.dom.AbstractElement_insertion.
Available since: 4.1.0
Parameters
- el : String/HTMLElement/Ext.dom.AbstractElement/Object
The new element (id of the node, a DOM Node
or an existing Element) or a DomHelper config of an element to create
Returns
- Ext.dom.AbstractElement
This element
Animates the transition of an element's dimensions from a starting height/width to an ending height/width. ...Animates the transition of an element's dimensions from a starting height/width to an ending height/width. This
method is a convenience implementation of shift. Usage:
// change height and width to 100x100 pixels
el.scale(100, 100);
// common config options shown with default values. The height and width will default to
// the element's existing values if passed as null.
el.scale(
[element's width],
[element's height], {
easing: 'easeOut',
duration: 350
}
);
Defined in override Ext.dom.Element_anim.
This method has been deprecated since 4.0
Just use animate instead.
Available since: 4.0.0
Parameters
- width : Number
The new width (pass undefined to keep the original width)
- height : Number
The new height (pass undefined to keep the original height)
- options : Object (optional)
Object literal with any of the Fx config options
Returns
- Ext.Element
The Element
Scrolls this element the specified direction. ...Scrolls this element the specified direction. Does bounds checking to make sure the scroll is
within this element's scrollable range.
Defined in override Ext.dom.Element_scroll.
Available since: 1.1.0
Parameters
- direction : String
Possible values are:
"l" (or "left")
"r" (or "right")
"t" (or "top", or "up")
"b" (or "bottom", or "down")
- distance : Number
How far to scroll the element in pixels
- animate : Boolean/Object (optional)
true for the default animation or a standard Element
animation config object
Returns
- Boolean
Returns true if a scroll was triggered or false if the element
was scrolled as far as it could go.
Scrolls this element by the passed delta values, optionally animating. ...Scrolls this element by the passed delta values, optionally animating.
All of the following are equivalent:
el.scrollBy(10, 10, true);
el.scrollBy([10, 10], true);
el.scrollBy({ x: 10, y: 10 }, true);
Defined in override Ext.dom.Element_scroll.
Available since: 4.1.0
Parameters
- deltaX : Number/Number[]/Object
Either the x delta, an Array specifying x and y deltas or
an object with "x" and "y" properties.
- deltaY : Number/Boolean/Object
Either the y delta, or an animate flag or config object.
- animate : Boolean/Object
Animate flag/config object if the delta values were passed separately.
Returns
- Ext.Element
this
scrollChildIntoView( child, hscroll )private Scrolls this element into view within the passed container. ...Scrolls this element into view within the passed container.
Defined in override Ext.dom.Element_scroll.
Available since: 1.1.0
Parameters
- container : String/HTMLElement/Ext.Element (optional)
The container element
to scroll. Should be a string (id), dom node, or Ext.Element.
Defaults to: document.body
- hscroll : Boolean (optional)
False to disable horizontal scroll.
Defaults to: true
- animate : Boolean/Object (optional)
true for the default animation or a standard Element
animation config object
Returns
- Ext.dom.Element
this
Scrolls this element the specified scroll point. ...Scrolls this element the specified scroll point. It does NOT do bounds checking so
if you scroll to a weird value it will try to do it. For auto bounds checking, use scroll.
Defined in override Ext.dom.Element_scroll.
Available since: 1.1.0
Parameters
- side : String
Either "left" for scrollLeft values or "top" for scrollTop values.
- value : Number
The new scroll value
- animate : Boolean/Object (optional)
true for the default animation or a standard Element
animation config object
Returns
- Ext.Element
this
Creates a Ext.CompositeElement for child nodes based on the passed CSS selector (the selector should not contain an id). ...Creates a Ext.CompositeElement for child nodes based on the passed CSS selector (the selector should not contain an id).
Defined in override Ext.dom.AbstractElement_traversal.
Available since: 4.1.0
Parameters
- selector : String
The CSS selector
- unique : Boolean (optional)
True to create a unique Ext.Element for each element. Defaults to a shared flyweight object.
Returns
- Ext.CompositeElement
The composite element
selectable( ) : Ext.ElementEnable text selection for this element (normalized across browsers)
Defined in override Ext.dom.Element_style. ...Enable text selection for this element (normalized across browsers)
Defined in override Ext.dom.Element_style.
Available since: 4.0.6
Returns
- Ext.Element
this
Sets the passed attributes as attributes of this element (a style attribute can be a string, object or function) ...Sets the passed attributes as attributes of this element (a style attribute can be a string, object or function)
Available since: 4.1.0
Parameters
- o : Object
The object with the attributes
- useSet : Boolean (optional)
false to override the default setAttribute to use expandos.
Defaults to: true
Returns
- Ext.dom.Element
this
Sets the element's CSS bottom style. ...Sets the element's CSS bottom style.
Defined in override Ext.dom.AbstractElement_position.
Available since: 4.1.0
Parameters
- bottom : String
The bottom CSS property value
Returns
Sets the element's position and size in one shot. ...Sets the element's position and size in one shot. If animation is true then width, height,
x and y will be animated concurrently.
Defined in override Ext.dom.Element_position.
Available since: 1.1.0
Parameters
- x : Number
X value for new position (coordinates are page-based)
- y : Number
Y value for new position (coordinates are page-based)
- width : Number/String
The new width. This may be one of:
- A Number specifying the new width in this Element's defaultUnits (by default, pixels)
- A String used to set the CSS width style. Animation may not be used.
- height : Number/String
The new height. This may be one of:
- A Number specifying the new height in this Element's defaultUnits (by default, pixels)
- A String used to set the CSS height style. Animation may not be used.
- animate : Boolean/Object (optional)
true for the default animation or a standard Element
animation config object
Returns
Sets the element's box. ...Sets the element's box. Use getBox() on another element to get a box obj.
If animate is true then width, height, x and y will be animated concurrently.
Defined in override Ext.dom.AbstractElement_position.
Available since: 4.1.0
Parameters
- box : Object
The box to fill {x, y, width, height}
- adjust : Boolean (optional)
Whether to adjust for box-model issues automatically
- animate : Boolean/Object (optional)
true for the default animation or a standard
Element animation config object
Returns
Sets the CSS display property. ...Sets the CSS display property. Uses originalDisplay if the specified value is a boolean true.
Defined in override Ext.dom.Element_fx.
Available since: 1.1.0
Parameters
- value : Boolean/String
Boolean value to display the element using its default display, or a string to set the display directly.
Returns
- Ext.dom.Element
this
Set the innerHTML of this element ...Set the innerHTML of this element
Available since: 4.1.0
Parameters
- html : String
The new HTML
Returns
- Ext.Element
this
Set the height of this Element. ...Set the height of this Element.
// change the height to 200px and animate with default configuration
Ext.fly('elementId').setHeight(200, true);
// change the height to 150px and animate with a custom configuration
Ext.fly('elId').setHeight(150, {
duration : 500, // animation will have a duration of .5 seconds
// will change the content to "finished"
callback: function(){ this.update("finished"); }
});
Defined in override Ext.dom.AbstractElement_style.
Available since: 4.1.0
Parameters
- height : Number/String
The new height. This may be one of:
- A Number specifying the new height in this Element's defaultUnits (by default, pixels.)
- A String used to set the CSS height style. Animation may not be used.
- animate : Boolean/Object (optional)
true for the default animation or a standard Element animation config object
Returns
- Ext.dom.Element
this
setHorizontal( )★privateRemoves "vertical" state from this element (reverses everything done
by setVertical). ...Removes "vertical" state from this element (reverses everything done
by setVertical).
Defined in override Ext.dom.Element_style.
Available since: Ext JS 4.1.3
Conveniently sets left and top adding default units. ...Conveniently sets left and top adding default units.
Defined in override Ext.dom.Element_position.
Available since: 1.1.0
Parameters
Returns
- Ext.dom.Element
this
Sets the position of the element in page coordinates, regardless of how the element
is positioned. ...Sets the position of the element in page coordinates, regardless of how the element
is positioned. The element must be part of the DOM tree to have page coordinates
(display:none or elements not appended return false).
Defined in override Ext.dom.Element_position.
Available since: 1.1.0
Parameters
- x : Number
X value for new position (coordinates are page-based)
- y : Number
Y value for new position (coordinates are page-based)
- animate : Boolean/Object (optional)
True for the default animation, or a standard Element
animation config object
Returns
Set the opacity of the element
Defined in override Ext.dom.Element_style. ...Set the opacity of the element
Defined in override Ext.dom.Element_style.
Available since: 1.1.0
Parameters
- opacity : Number
The new opacity. 0 = transparent, .5 = 50% visibile, 1 = fully visible, etc
- animate : Boolean/Object (optional)
a standard Element animation config object or true for
the default animation ({duration: 350, easing: 'easeIn'})
Returns
- Ext.dom.Element
this
Set positioning with an object returned by getPositioning. ...Set positioning with an object returned by getPositioning.
Defined in override Ext.dom.Element_position.
Available since: 1.1.0
Parameters
- posCfg : Object
Returns
Sets the element's position and size the specified region. ...Sets the element's position and size the specified region. If animation is true then width, height,
x and y will be animated concurrently.
Defined in override Ext.dom.Element_position.
Available since: 1.1.0
Parameters
- region : Ext.util.Region
The region to fill
- animate : Boolean/Object (optional)
true for the default animation or a standard Element
animation config object
Returns
Sets the element's CSS right style. ...Sets the element's CSS right style.
Defined in override Ext.dom.AbstractElement_position.
Available since: 4.1.0
Parameters
- right : String
The right CSS property value
Returns
Set the size of this Element. ...Set the size of this Element. If animation is true, both width and height will be animated concurrently.
Defined in override Ext.dom.AbstractElement_style.
Available since: 4.1.0
Parameters
- width : Number/String
The new width. This may be one of:
- A Number specifying the new width in this Element's defaultUnits (by default, pixels).
- A String used to set the CSS width style. Animation may not be used.
- A size object in the format
{width: widthValue, height: heightValue}.
- height : Number/String
The new height. This may be one of:
- A Number specifying the new height in this Element's defaultUnits (by default, pixels).
- A String used to set the CSS height style. Animation may not be used.
- animate : Boolean/Object (optional)
true for the default animation or a standard Element animation config object
Returns
- Ext.dom.Element
this
Wrapper for setting style properties, also takes single object parameter of multiple styles. ...Wrapper for setting style properties, also takes single object parameter of multiple styles.
Defined in override Ext.dom.AbstractElement_style.
Available since: 4.1.0
Parameters
- property : String/Object
The style property to be set, or an object of multiple styles.
- value : String (optional)
The value to apply to the given property, or null if an object was passed.
Returns
- Ext.dom.Element
this
setVertical( cls )★privateChanges this Element's state to "vertical" (rotated 90 or 270 degrees). ...Changes this Element's state to "vertical" (rotated 90 or 270 degrees).
This involves inverting the getters and setters for height and width
(getWidth becomes getHeight and vice versa), setStyle and getStyle will
also return the inverse when height or width are being operated on.
Defined in override Ext.dom.Element_style.
Available since: Ext JS 4.1.3
Parameters
- cls : String
an optional css class that contains the required
styles for switching the element to vertical orientation. Omit this if
the element already contains vertical styling. If cls is provided,
it will be removed from the element when setHorizontal is called.
Use this to change the visibility mode between VISIBILITY, DISPLAY, OFFSETS or ASCLASS. ...Use this to change the visibility mode between VISIBILITY, DISPLAY, OFFSETS or ASCLASS.
Available since: 4.1.0
Parameters
- mode : Object
Returns
Sets the visibility of the element (see details). ...Sets the visibility of the element (see details). If the visibilityMode is set to Element.DISPLAY, it will use
the display property to hide the element, otherwise it uses visibility. The default is to hide and show using the visibility property.
Defined in override Ext.dom.Element_fx.
Available since: 1.1.0
Parameters
- visible : Boolean
Whether the element is visible
- animate : Boolean/Object (optional)
True for the default animation, or a standard Element animation config object
Returns
- Ext.dom.Element
this
Overrides: Ext.dom.AbstractElement.setVisible
Set the width of this Element. ...Set the width of this Element.
Defined in override Ext.dom.AbstractElement_style.
Available since: 4.1.0
Parameters
- width : Number/String
The new width. This may be one of:
- A Number specifying the new width in this Element's defaultUnits (by default, pixels).
- A String used to set the CSS width style. Animation may not be used.
- animate : Boolean/Object (optional)
true for the default animation or a standard Element animation config object
Returns
- Ext.dom.Element
this
Sets the X position of the element based on page coordinates. ...Sets the X position of the element based on page coordinates. Element must be part of the DOM tree
to have page coordinates (display:none or elements not appended return false).
Defined in override Ext.dom.AbstractElement_position.
Available since: 4.1.0
Parameters
- The : Number
X position of the element
- animate : Boolean/Object (optional)
True for the default animation, or a standard Element
animation config object
Returns
Sets the position of the element in page coordinates, regardless of how the element
is positioned. ...Sets the position of the element in page coordinates, regardless of how the element
is positioned. The element must be part of the DOM tree to have page coordinates
(display:none or elements not appended return false).
Defined in override Ext.dom.Element_position.
Available since: 1.1.0
Parameters
- pos : Number[]
Contains X & Y [x, y] values for new position (coordinates are page-based)
- animate : Boolean/Object (optional)
True for the default animation, or a standard Element
animation config object
Returns
- Ext.Element
this
Overrides: Ext.dom.AbstractElement.setXY
Sets the Y position of the element based on page coordinates. ...Sets the Y position of the element based on page coordinates. Element must be part of the DOM tree
to have page coordinates (display:none or elements not appended return false).
Defined in override Ext.dom.AbstractElement_position.
Available since: 4.1.0
Parameters
- The : Number
Y position of the element
- animate : Boolean/Object (optional)
True for the default animation, or a standard Element
animation config object
Returns
Animates the transition of any combination of an element's dimensions, xy position and/or opacity. ...Animates the transition of any combination of an element's dimensions, xy position and/or opacity. Any of these
properties not specified in the config object will not be changed. This effect requires that at least one new
dimension, position or opacity setting must be passed in on the config object in order for the function to have
any effect. Usage:
// slide the element horizontally to x position 200 while changing the height and opacity
el.shift({ x: 200, height: 50, opacity: .8 });
// common config options shown with default values.
el.shift({
width: [element's width],
height: [element's height],
x: [element's x position],
y: [element's y position],
opacity: [element's opacity],
easing: 'easeOut',
duration: 350
});
Defined in override Ext.dom.Element_anim.
This method has been deprecated since 4.0
Just use animate instead.
Available since: 4.0.0
Parameters
- options : Object
Object literal with any of the Fx config options
Returns
- Ext.Element
The Element
Show this element - Uses display mode to determine whether to use "display" or "visibility". ...Show this element - Uses display mode to determine whether to use "display" or "visibility". See setVisible.
Defined in override Ext.dom.Element_fx.
Available since: 1.1.0
Parameters
- animate : Boolean/Object (optional)
true for the default animation or a standard Element animation config object
Returns
- Ext.dom.Element
this
Overrides: Ext.dom.AbstractElement.show
Slides the element into view. ...Slides the element into view. An anchor point can be optionally passed to set the point of origin for the slide
effect. This function automatically handles wrapping the element with a fixed-size container if needed. See the
Fx class overview for valid anchor point options. Usage:
// default: slide the element in from the top
el.slideIn();
// custom: slide the element in from the right with a 2-second duration
el.slideIn('r', { duration: 2000 });
// common config options shown with default values
el.slideIn('t', {
easing: 'easeOut',
duration: 500
});
Defined in override Ext.dom.Element_anim.
Available since: 4.0.0
Parameters
- anchor : String (optional)
One of the valid Fx anchor positions (defaults to top: 't')
- options : Object (optional)
Object literal with any of the Fx config options
- preserveScroll : Boolean
Set to true if preservation of any descendant elements'
scrollTop values is required. By default the DOM wrapping operation performed by slideIn and
slideOut causes the browser to lose all scroll positions.
Returns
- Ext.dom.Element
The Element
Slides the element out of view. ...Slides the element out of view. An anchor point can be optionally passed to set the end point for the slide
effect. When the effect is completed, the element will be hidden (visibility = 'hidden') but block elements will
still take up space in the document. The element must be removed from the DOM using the 'remove' config option if
desired. This function automatically handles wrapping the element with a fixed-size container if needed. See the
Fx class overview for valid anchor point options. Usage:
// default: slide the element out to the top
el.slideOut();
// custom: slide the element out to the right with a 2-second duration
el.slideOut('r', { duration: 2000 });
// common config options shown with default values
el.slideOut('t', {
easing: 'easeOut',
duration: 500,
remove: false,
useDisplay: false
});
Defined in override Ext.dom.Element_anim.
Available since: 4.0.0
Parameters
- anchor : String (optional)
One of the valid Fx anchor positions (defaults to top: 't')
- options : Object (optional)
Object literal with any of the Fx config options
Returns
- Ext.dom.Element
The Element
Get the reference to the class from which this object was instantiated. ...Get the reference to the class from which this object was instantiated. Note that unlike self,
this.statics() is scope-independent and it always returns the class from which it was called, regardless of what
this points to during run-time
Ext.define('My.Cat', {
statics: {
totalCreated: 0,
speciesName: 'Cat' // My.Cat.speciesName = 'Cat'
},
constructor: function() {
var statics = this.statics();
alert(statics.speciesName); // always equals to 'Cat' no matter what 'this' refers to
// equivalent to: My.Cat.speciesName
alert(this.self.speciesName); // dependent on 'this'
statics.totalCreated++;
},
clone: function() {
var cloned = new this.self; // dependent on 'this'
cloned.groupName = this.statics().speciesName; // equivalent to: My.Cat.speciesName
return cloned;
}
});
Ext.define('My.SnowLeopard', {
extend: 'My.Cat',
statics: {
speciesName: 'Snow Leopard' // My.SnowLeopard.speciesName = 'Snow Leopard'
},
constructor: function() {
this.callParent();
}
});
var cat = new My.Cat(); // alerts 'Cat', then alerts 'Cat'
var snowLeopard = new My.SnowLeopard(); // alerts 'Cat', then alerts 'Snow Leopard'
var clone = snowLeopard.clone();
alert(Ext.getClassName(clone)); // alerts 'My.SnowLeopard'
alert(clone.groupName); // alerts 'Cat'
alert(My.Cat.totalCreated); // alerts 3
Available since: 4.0.0
Returns
Stops the specified event(s) from bubbling and optionally prevents the default action ...Stops the specified event(s) from bubbling and optionally prevents the default action
Available since: 1.1.0
Parameters
- eventName : String/String[]
an event / array of events to stop from bubbling
- preventDefault : Boolean (optional)
true to prevent the default action too
Returns
- Ext.dom.Element
this
Blinks the element as if it was clicked and then collapses on its center (similar to switching off a television). ...Blinks the element as if it was clicked and then collapses on its center (similar to switching off a television).
When the effect is completed, the element will be hidden (visibility = 'hidden') but block elements will still
take up space in the document. The element must be removed from the DOM using the 'remove' config option if
desired. Usage:
// default
el.switchOff();
// all config options shown with default values
el.switchOff({
easing: 'easeIn',
duration: .3,
remove: false,
useDisplay: false
});
Defined in override Ext.dom.Element_anim.
Available since: 4.0.0
Parameters
- options : Object (optional)
Object literal with any of the Fx config options
Returns
- Ext.dom.Element
The Element
syncContent( source )private.
Currently used for updating grid cells without modifying DOM structure
Synchronizes content of this Element with t....
Currently used for updating grid cells without modifying DOM structure
Synchronizes content of this Element with the content of the passed element.
Style and CSS class are copied from source into this Element, and contents are synched
recursively. If a child node is a text node, the textual data is copied.
Available since: 4.1.1
Parameters
- source : Object
Toggles the element's visibility or display, depending on visibility mode. ...Toggles the element's visibility or display, depending on visibility mode.
Defined in override Ext.dom.Element_fx.
Available since: 1.1.0
Parameters
- animate : Boolean/Object (optional)
True for the default animation, or a standard Element animation config object
Returns
- Ext.dom.Element
this
Toggles the specified CSS class on this element (removes it if it already exists, otherwise adds it). ...Toggles the specified CSS class on this element (removes it if it already exists, otherwise adds it).
Defined in override Ext.dom.AbstractElement_style.
Available since: 4.1.0
Parameters
- className : String
The CSS class to toggle
Returns
- Ext.dom.Element
this
Translates the passed page coordinates into left/top css values for this element
Defined in override Ext.dom.Abstrac...Translates the passed page coordinates into left/top css values for this element
Defined in override Ext.dom.AbstractElement_position.
Available since: 4.1.0
Parameters
- x : Number/Array
The page x or an array containing [x, y]
- y : Number (optional)
The page y, required if x is not an array
Returns
- Object
An object with left and top properties. e.g. {left: (value), top: (value)}
Removes an event handler from this element. ...Removes an event handler from this element.
Note: if a scope was explicitly specified when adding the listener,
the same scope must be specified here.
Example:
el.un('click', this.handlerFn);
// or
el.removeListener('click', this.handlerFn);
Available since: 1.1.0
Parameters
- eventName : String
The name of the event from which to remove the handler.
- fn : Function
The handler function to remove. This must be a reference to the function passed into the
on call.
- scope : Object
If a scope (this reference) was specified when the listener was added, then this must
refer to the same object.
Returns
- Ext.dom.Element
this
unclip( ) : Ext.dom.ElementchainableReturn clipping (overflow) to original clipping before clip was called
Defined in override Ext.dom.Element_style. ...Return clipping (overflow) to original clipping before clip was called
Defined in override Ext.dom.Element_style.
Available since: 1.1.0
Returns
- Ext.dom.Element
this
unselectable( ) : Ext.dom.ElementchainableDisables text selection for this element (normalized across browsers)
Defined in override Ext.dom.Element_style. ...Disables text selection for this element (normalized across browsers)
Defined in override Ext.dom.Element_style.
Available since: 1.1.0
Returns
- Ext.dom.Element
this
Walks up the dom looking for a parent node that matches the passed simple selector (e.g. ...Walks up the dom looking for a parent node that matches the passed simple selector (e.g. div.some-class or span:first-child).
This is a shortcut for findParentNode() that always returns an Ext.dom.Element.
Defined in override Ext.dom.AbstractElement_traversal.
Available since: 4.1.0
Parameters
- selector : String
The simple selector to test
- limit : Number/String/HTMLElement/Ext.Element (optional)
The max depth to search as a number or an element which causes the upward traversal to stop
and is not considered for inclusion as the result. (defaults to 50 || document.documentElement)
Returns
- Ext.Element
The matching DOM node (or null if no match was found)
Updates the innerHTML of this element, optionally searching for and processing scripts. ...Updates the innerHTML of this element, optionally searching for and processing scripts.
Available since: 1.1.0
Parameters
- html : String
The new HTML
- loadScripts : Boolean (optional)
True to look for and process scripts (defaults to false)
- callback : Function (optional)
For async script loading you can be notified when the update completes
Returns
- Ext.dom.Element
this
Overrides: Ext.dom.AbstractElement.update
Creates and wraps this element with another element
Defined in override Ext.dom.AbstractElement_insertion. ...Creates and wraps this element with another element
Defined in override Ext.dom.AbstractElement_insertion.
Available since: 4.1.0
Parameters
- config : Object (optional)
DomHelper element config object for the wrapper element or null for an empty div
- returnDom : Boolean (optional)
True to return the raw DOM element instead of Ext.dom.AbstractElement
Defaults to: false
- selector : String (optional)
A DomQuery selector to select a descendant node within the created element to use as the wrapping element.
Returns
- HTMLElement/Ext.dom.AbstractElement
The newly created wrapper element
Creates new Element directly.
Available since: 1.1.0
Parameters
- element : String/HTMLElement
- forceNew : Boolean (optional)
By default the constructor checks to see if there is already an instance of this element in the cache and if there is it returns the same instance. This will skip that check (useful for extending this class).
Returns
Overrides: Ext.dom.AbstractElement.constructor
Adds one or more CSS classes to the element. Duplicate classes are automatically filtered out.
Defined in override Ext.dom.AbstractElement_style.
Available since: 4.1.0
Parameters
Returns
- Ext.dom.Element
this
Sets up event handlers to add and remove a css class when the mouse is down and then up on this element (a click effect)
Defined in override Ext.dom.Element_style.
Available since: 4.0.0
Parameters
- className : String
The class to add
- testFn : Function (optional)
A test function to execute before adding the class. The passed parameter will be the Element instance. If this functions returns false, the class will not be added.
- scope : Object (optional)
The scope to execute the testFn in.
Returns
- Ext.dom.Element
this
Sets up event handlers to add and remove a css class when this element has the focus
Defined in override Ext.dom.Element_style.
Available since: 4.0.0
Parameters
- className : String
The class to add
- testFn : Function (optional)
A test function to execute before adding the class. The passed parameter will be the Element instance. If this functions returns false, the class will not be added.
- scope : Object (optional)
The scope to execute the testFn in.
Returns
- Ext.dom.Element
this
Sets up event handlers to add and remove a css class when the mouse is over this element
Defined in override Ext.dom.Element_style.
Available since: 4.0.0
Parameters
- className : String
The class to add
- testFn : Function (optional)
A test function to execute before adding the class. The passed parameter will be the Element instance. If this functions returns false, the class will not be added.
- scope : Object (optional)
The scope to execute the testFn in.
Returns
- Ext.dom.Element
this
Convenience method for constructing a KeyMap
Available since: 1.1.0
Parameters
- key : String/Number/Number[]/Object
- fn : Function
The function to call
- scope : Object (optional)
The scope (
thisreference) in which the specified function is executed. Defaults to this Element.
Returns
- Ext.util.KeyMap
The KeyMap created
Creates a KeyMap for this element
Available since: 1.1.0
Parameters
- config : Object
The KeyMap config. See Ext.util.KeyMap for more details
Returns
- Ext.util.KeyMap
The KeyMap created
Shorthand for on.
Appends an event handler to this element.
Available since: 1.1.0
Parameters
- eventName : String
The name of event to handle.
- fn : Function
The handler function the event invokes. This function is passed the following parameters:
evt : EventObject
The EventObject describing the event.
el : HtmlElement
The DOM 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 call that setup the listener.
- scope : Object (optional)
The scope (this reference) in which the handler function is executed. If omitted, defaults to this 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. If omitted, defaults to this Element.
delegate String:
A simple selector to filter the target or look for a descendant of the target. See below for additional details.
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
target Ext.dom.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.
delay Number:
The number of milliseconds to delay the invocation of the handler after the 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.
Combining Options
Using the options argument, it is possible to combine different types of listeners:
A delayed, one-time listener that auto stops the event and adds a custom argument (forumId) to the options object. The options object is available as the third parameter in the handler function.
Code:
el.on('click', this.onClick, this, { single: true, delay: 100, stopEvent : true, forumId: 4 });Attaching multiple handlers in 1 call
The method also allows for a single argument to be passed which is a config object containing properties which specify multiple handlers.
Code:
el.on({ 'click' : { fn: this.onClick, scope: this, delay: 100 }, 'mouseover' : { fn: this.onMouseOver, scope: this }, 'mouseout' : { fn: this.onMouseOut, scope: this } });Or a shorthand syntax:
Code:
el.on({ 'click' : this.onClick, 'mouseover' : this.onMouseOver, 'mouseout' : this.onMouseOut, scope: this });delegate
This is a configuration option that you can pass along when registering a handler for an event to assist with event delegation. Event delegation is a technique that is used to reduce memory consumption and prevent exposure to memory-leaks. By registering an event for a container element as opposed to each element within a container. By setting this configuration option to a simple selector, the target element will be filtered to look for a descendant of the target. For example:
// using this markup: <div id='elId'> <p id='p1'>paragraph one</p> <p id='p2' class='clickable'>paragraph two</p> <p id='p3'>paragraph three</p> </div> // utilize event delegation to registering just one handler on the container element: el = Ext.get('elId'); el.on( 'click', function(e,t) { // handle click console.info(t.id); // 'p2' }, this, { // filter the target element to be a descendant with the class 'clickable' delegate: '.clickable' } );
Returns
- Ext.dom.Element
this
Aligns this element with another element relative to the specified anchor points. If the other element is the document it aligns it to the viewport. The position parameter is optional, and can be specified in any one of the following formats:
- Blank: Defaults to aligning the element's top-left corner to the target's bottom-left corner ("tl-bl").
- One anchor (deprecated): The passed anchor position is used as the target element's anchor point. The element being aligned will position its top-left corner (tl) to that point. This method has been deprecated in favor of the newer two anchor syntax below.
- Two anchors: If two values from the table below are passed separated by a dash, the first value is used as the element's anchor point, and the second value is used as the target's anchor point.
In addition to the anchor points, the position parameter also supports the "?" character. If "?" is passed at the end of the position string, the element will attempt to align as specified, but the position will be adjusted to constrain to the viewport if necessary. Note that the element being aligned might be swapped to align to a different position than that specified in order to enforce the viewport constraints. Following are all of the supported anchor positions:
Value Description ----- ----------------------------- tl The top left corner (default) t The center of the top edge tr The top right corner l The center of the left edge c In the center of the element r The center of the right edge bl The bottom left corner b The center of the bottom edge br The bottom right corner
Example Usage:
// align el to other-el using the default positioning ("tl-bl", non-constrained)
el.alignTo("other-el");
// align the top left corner of el with the top right corner of other-el (constrained to viewport)
el.alignTo("other-el", "tr?");
// align the bottom right corner of el with the center left edge of other-el
el.alignTo("other-el", "br-l?");
// align the center of el with the bottom left corner of other-el and
// adjust the x position by -6 pixels (and the y position by 0)
el.alignTo("other-el", "c-bl", [-6, 0]);
Defined in override Ext.dom.Element_alignment.
Available since: 1.1.0
Parameters
- element : String/HTMLElement/Ext.Element
The element to align to.
- position : String (optional)
The position to align to
Defaults to:
"tl-bl?" - offsets : Number[] (optional)
Offset the positioning by [x, y]
- animate : Boolean/Object (optional)
true for the default animation or a standard Element animation config object
Returns
- Ext.Element
this
Anchors an element to another element and realigns it when the window is resized.
Defined in override Ext.dom.Element_alignment.
Available since: 1.1.0
Parameters
- element : String/HTMLElement/Ext.Element
The element to align to.
- position : String
The position to align to.
- offsets : Number[] (optional)
Offset the positioning by [x, y]
- animate : Boolean/Object (optional)
True for the default animation or a standard Element animation config object
- monitorScroll : Boolean/Number (optional)
True to monitor body scroll and reposition. If this parameter is a number, it is used as the buffer delay (defaults to 50ms).
- callback : Function (optional)
The function to call after the animation finishes
Returns
- Ext.Element
this
- process the passed fx configuration.
Defined in override Ext.dom.Element_anim.
Available since: 4.1.2
Parameters
- config : Object
Performs custom animation on this Element.
The following properties may be specified in from, to, and keyframe objects:
x- The page X position in pixels.y- The page Y position in pixelsleft- The element's CSSleftvalue. Units must be supplied.top- The element's CSStopvalue. Units must be supplied.width- The element's CSSwidthvalue. Units must be supplied.height- The element's CSSheightvalue. Units must be supplied.scrollLeft- The element'sscrollLeftvalue.scrollTop- The element'sscrollTopvalue.opacity- The element'sopacityvalue. This must be a value between0and1.
Be aware that animating an Element which is being used by an Ext Component without in some way informing the Component about the changed element state will result in incorrect Component behaviour. This is because the Component will be using the old state of the element. To avoid this problem, it is now possible to directly animate certain properties of Components.
Defined in override Ext.dom.Element_anim.
Available since: 1.1.0
Parameters
- config : Object
Configuration for Ext.fx.Anim. Note that the to config is required.
Returns
- Ext.dom.Element
this
Appends the passed element(s) to this element
Defined in override Ext.dom.AbstractElement_insertion.
Available since: 4.1.0
Parameters
- el : String/HTMLElement/Ext.dom.AbstractElement
The id of the node, a DOM Node or an existing Element.
Returns
- Ext.dom.AbstractElement
This element
Appends this element to the passed element
Defined in override Ext.dom.AbstractElement_insertion.
Available since: 4.1.0
Parameters
- el : String/HTMLElement/Ext.dom.AbstractElement
The new parent element. The id of the node, a DOM Node or an existing Element.
Returns
- Ext.dom.AbstractElement
This element
More flexible version of setStyle for setting style properties.
Defined in override Ext.dom.AbstractElement_style.
Available since: 4.1.0
Parameters
- styles : String/Object/Function
A style specification string, e.g. "width:100px", or object in the form {width:"100px"}, or a function which returns such a specification.
Returns
- Ext.dom.Element
this
Tries to blur the element. Any exceptions are caught and ignored.
Available since: 1.1.0
Returns
- Ext.dom.Element
this
Wraps the specified element with a special 9 element markup/CSS block that renders by default as a gray container with a gradient background, rounded corners and a 4-way shadow.
This special markup is used throughout Ext when box wrapping elements (Ext.button.Button, Ext.panel.Panel when frame=true, Ext.window.Window). The markup is of this form:
Ext.dom.Element.boxMarkup =
'<div class="{0}-tl"><div class="{0}-tr"><div class="{0}-tc"></div></div></div>
<div class="{0}-ml"><div class="{0}-mr"><div class="{0}-mc"></div></div></div>
<div class="{0}-bl"><div class="{0}-br"><div class="{0}-bc"></div></div></div>';
Example usage:
// Basic box wrap
Ext.get("foo").boxWrap();
// You can also add a custom class and use CSS inheritance rules to customize the box look.
// 'x-box-blue' is a built-in alternative -- look at the related CSS definitions as an example
// for how to create a custom box wrap style.
Ext.get("foo").boxWrap().addCls("x-box-blue");
Defined in override Ext.dom.Element_style.
Available since: 1.1.0
Parameters
- class : String (optional)
A base CSS class to apply to the containing wrapper element. Note that there are a number of CSS rules that are dependent on this name to make the overall effect work, so if you supply an alternate base class, make sure you also supply all of the necessary rules.
Defaults to:
'x-box'
Returns
- Ext.dom.Element
The outermost wrapping element of the created box structure.
When an element is moved around in the DOM, or is hidden using display:none, it loses layout, and therefore
all scroll positions of all descendant elements are lost.
This function caches them, and returns a function, which when run will restore the cached positions. In the following example, the Panel is moved from one Container to another which will cause it to lose all scroll positions:
var restoreScroll = myPanel.el.cacheScrollValues();
myOtherContainer.add(myPanel);
restoreScroll();
Available since: 4.1.0
Returns
- Function
A function which will restore all descentant elements of this Element to their scroll positions recorded when this function was executed. Be aware that the returned function is a closure which has captured the scope of
cacheScrollValues, so take care to derefence it as soon as not needed - if is it is avarit will drop out of scope, and the reference will be freed.
Call the original method that was previously overridden with override
Ext.define('My.Cat', {
constructor: function() {
alert("I'm a cat!");
}
});
My.Cat.override({
constructor: function() {
alert("I'm going to be a cat!");
this.callOverridden();
alert("Meeeeoooowwww");
}
});
var kitty = new My.Cat(); // alerts "I'm going to be a cat!"
// alerts "I'm a cat!"
// alerts "Meeeeoooowwww"
This method has been deprecated
as of 4.1. Use callParent instead.
Available since: 4.0.0
Parameters
- args : Array/Arguments
The arguments, either an array or the
argumentsobject from the current method, for example:this.callOverridden(arguments)
Returns
- Object
Returns the result of calling the overridden method
Call the "parent" method of the current method. That is the method previously overridden by derivation or by an override (see Ext.define).
Ext.define('My.Base', {
constructor: function (x) {
this.x = x;
},
statics: {
method: function (x) {
return x;
}
}
});
Ext.define('My.Derived', {
extend: 'My.Base',
constructor: function () {
this.callParent([21]);
}
});
var obj = new My.Derived();
alert(obj.x); // alerts 21
This can be used with an override as follows:
Ext.define('My.DerivedOverride', {
override: 'My.Derived',
constructor: function (x) {
this.callParent([x*2]); // calls original My.Derived constructor
}
});
var obj = new My.Derived();
alert(obj.x); // now alerts 42
This also works with static methods.
Ext.define('My.Derived2', {
extend: 'My.Base',
statics: {
method: function (x) {
return this.callParent([x*2]); // calls My.Base.method
}
}
});
alert(My.Base.method(10); // alerts 10
alert(My.Derived2.method(10); // alerts 20
Lastly, it also works with overridden static methods.
Ext.define('My.Derived2Override', {
override: 'My.Derived2',
statics: {
method: function (x) {
return this.callParent([x*2]); // calls My.Derived2.method
}
}
});
alert(My.Derived2.method(10); // now alerts 40
To override a method and replace it and also call the superclass method, use callSuper. This is often done to patch a method to fix a bug.
Available since: 4.0.0
Parameters
- args : Array/Arguments
The arguments, either an array or the
argumentsobject from the current method, for example:this.callParent(arguments)
Returns
- Object
Returns the result of calling the parent method
This method is used by an override to call the superclass method but bypass any overridden method. This is often done to "patch" a method that contains a bug but for whatever reason cannot be fixed directly.
Consider:
Ext.define('Ext.some.Class', {
method: function () {
console.log('Good');
}
});
Ext.define('Ext.some.DerivedClass', {
method: function () {
console.log('Bad');
// ... logic but with a bug ...
this.callParent();
}
});
To patch the bug in DerivedClass.method, the typical solution is to create an
override:
Ext.define('App.paches.DerivedClass', {
override: 'Ext.some.DerivedClass',
method: function () {
console.log('Fixed');
// ... logic but with bug fixed ...
this.callSuper();
}
});
The patch method cannot use callParent to call the superclass method since
that would call the overridden method containing the bug. In other words, the
above patch would only produce "Fixed" then "Good" in the console log, whereas,
using callParent would produce "Fixed" then "Bad" then "Good".
Available since: Ext JS 4.1.3
Parameters
- args : Array/Arguments
The arguments, either an array or the
argumentsobject from the current method, for example:this.callSuper(arguments)
Returns
- Object
Returns the result of calling the superclass method
Centers the Element in either the viewport, or another Element.
Defined in override Ext.dom.Element_alignment.
Available since: 1.1.0
Parameters
- centerIn : String/HTMLElement/Ext.Element (optional)
The element in which to center the element.
Selects a single direct child based on the passed CSS selector (the selector should not contain an id).
Defined in override Ext.dom.AbstractElement_traversal.
Available since: 4.1.0
Parameters
- selector : String
The CSS selector
- returnDom : Boolean (optional)
True to return the DOM node instead of Ext.dom.Element.
Defaults to:
false
Returns
- HTMLElement/Ext.dom.Element
The child Ext.dom.Element (or DOM node if returnDom = true)
Removes Empty, or whitespace filled text nodes. Combines adjacent text nodes.
Available since: 1.1.0
Parameters
- forceReclean : Boolean (optional)
By default the element keeps track if it has been cleaned already so you can call this over and over. However, if you update the element and need to force a reclean, you can pass true.
Defaults to:
false
Alias for removeAllListeners.
Removes all previous added listeners from this element
Available since: 4.0.0
Returns
- Ext.dom.Element
this
Clears any opacity settings from this element. Required in some cases for IE.
Defined in override Ext.dom.Element_style.
Available since: 1.1.0
Returns
- Ext.dom.Element
this
Clears positioning back to the default when the document was loaded.
Defined in override Ext.dom.Element_position.
Available since: 1.1.0
Parameters
- value : String (optional)
The value to use for the left, right, top, bottom. You could use 'auto'.
Defaults to:
''
Returns
Store the current overflow setting and clip overflow on the element - use unclip to remove
Defined in override Ext.dom.Element_style.
Available since: 1.1.0
Returns
- Ext.dom.Element
this
Creates the passed DomHelper config and appends it to this element or optionally inserts it before the passed child element.
Defined in override Ext.dom.AbstractElement_insertion.
Available since: 4.1.0
Parameters
- config : Object
DomHelper element config object. If no tag is specified (e.g., {tag:'input'}) then a div will be automatically generated with the specified attributes.
- insertBefore : HTMLElement (optional)
a child element of this element
- returnDom : Boolean (optional)
true to return the dom node instead of creating an Element
Defaults to:
false
Returns
- Ext.dom.AbstractElement
The new child element
Creates a proxy element of this element
Available since: 1.1.0
Parameters
- config : String/Object
The class name of the proxy element or a DomHelper config object
- renderTo : String/HTMLElement (optional)
The element or element id to render the proxy to. Defaults to: document.body.
- matchBox : Boolean (optional)
True to align and size the proxy to this element now.
Defaults to:
false
Returns
- Ext.dom.Element
The new proxy element
Creates an iframe shim for this element to keep selects and other windowed objects from showing through.
Available since: 1.1.0
Returns
- Ext.dom.Element
The new shim element
Alias to remove.
Removes this element's dom reference. Note that event and cache removal is handled at Ext.removeNode
Available since: 4.1.0
Overrides: Ext.Base.destroy
Selects a single child at any depth below this element based on the passed CSS selector (the selector should not contain an id).
Defined in override Ext.dom.AbstractElement_traversal.
Available since: 4.1.0
Parameters
- selector : String
The CSS selector
- returnDom : Boolean (optional)
True to return the DOM node instead of Ext.dom.Element
Defaults to:
false
Returns
- HTMLElement/Ext.dom.Element
The child Ext.dom.Element (or DOM node if returnDom = true)
Convenience method for setVisibilityMode(Element.DISPLAY)
Available since: 1.1.0
Parameters
- display : String (optional)
What to set display to when visible
Returns
- Ext.dom.Element
this
Fade an element in (from transparent to opaque). The ending opacity can be specified using the opacity
config option. Usage:
// default: fade in from opacity 0 to 100%
el.fadeIn();
// custom: fade in from opacity 0 to 75% over 2 seconds
el.fadeIn({ opacity: .75, duration: 2000});
// common config options shown with default values
el.fadeIn({
opacity: 1, //can be any value between 0 and 1 (e.g. .5)
easing: 'easeOut',
duration: 500
});
Defined in override Ext.dom.Element_anim.
Available since: 4.0.0
Parameters
- options : Object (optional)
Object literal with any of the Fx config options
Returns
- Ext.Element
The Element
Fade an element out (from opaque to transparent). The ending opacity can be specified using the opacity
config option. Note that IE may require useDisplay:true in order to redisplay correctly.
Usage:
// default: fade out from the element's current opacity to 0
el.fadeOut();
// custom: fade out from the element's current opacity to 25% over 2 seconds
el.fadeOut({ opacity: .25, duration: 2000});
// common config options shown with default values
el.fadeOut({
opacity: 0, //can be any value between 0 and 1 (e.g. .5)
easing: 'easeOut',
duration: 500,
remove: false,
useDisplay: false
});
Defined in override Ext.dom.Element_anim.
Available since: 4.0.0
Parameters
- options : Object (optional)
Object literal with any of the Fx config options
Returns
- Ext.Element
The Element
Looks at this node and then at parent nodes for a match of the passed simple selector (e.g. div.some-class or span:first-child)
Defined in override Ext.dom.AbstractElement_traversal.
Available since: 4.1.0
Parameters
- selector : String
The simple selector to test
- limit : Number/String/HTMLElement/Ext.Element (optional)
The max depth to search as a number or an element which causes the upward traversal to stop and is not considered for inclusion as the result. (defaults to 50 || document.documentElement)
- returnEl : Boolean (optional)
True to return a Ext.Element object instead of DOM node
Defaults to:
false
Returns
- HTMLElement
The matching DOM node (or null if no match was found)
Looks at parent nodes for a match of the passed simple selector (e.g. div.some-class or span:first-child)
Defined in override Ext.dom.AbstractElement_traversal.
Available since: 4.1.0
Parameters
- selector : String
The simple selector to test
- limit : Number/String/HTMLElement/Ext.Element (optional)
The max depth to search as a number or an element which causes the upward traversal to stop and is not considered for inclusion as the result. (defaults to 50 || document.documentElement)
- returnEl : Boolean (optional)
True to return a Ext.Element object instead of DOM node
Defaults to:
false
Returns
- HTMLElement
The matching DOM node (or null if no match was found)
Gets the first child, skipping text nodes
Defined in override Ext.dom.AbstractElement_traversal.
Available since: 4.1.0
Parameters
- selector : String (optional)
Find the next sibling that matches the passed simple selector
- returnDom : Boolean (optional)
True to return a raw dom node instead of an Ext.dom.Element
Defaults to:
false
Returns
- Ext.dom.Element/HTMLElement
The first child or null
Tries to focus the element. Any exceptions are caught and ignored.
Available since: 1.1.0
Parameters
- defer : Number (optional)
Milliseconds to defer the focus
Returns
- Ext.dom.Element
this
Alias for isFocusable.
Checks whether this element can be focused.
Available since: 4.0.7
Parameters
- asFocusEl : Object
Returns
- Boolean
True if the element is focusable
Shows a ripple of exploding, attenuating borders to draw attention to an Element. Usage:
// default: a single light blue ripple
el.frame();
// custom: 3 red ripples lasting 3 seconds total
el.frame("#ff0000", 3, { duration: 3000 });
// common config options shown with default values
el.frame("#C3DAF9", 1, {
duration: 1000 // duration of each individual ripple.
// Note: Easing is not configurable and will be ignored if included
});
Defined in override Ext.dom.Element_anim.
Available since: 4.0.0
Parameters
- color : String (optional)
The hex color value for the border.
Defaults to:
'#C3DAF9' - count : Number (optional)
The number of ripples to display.
Defaults to:
1 - options : Object (optional)
Object literal with any of the Fx config options
Returns
- Ext.dom.Element
The Element
Returns the active element in the DOM. If the browser supports activeElement on the document, this is returned. If not, the focus is tracked and the active element is maintained internally.
Defined in override Ext.dom.AbstractElement_static.
Available since: 4.1.0
Returns
- HTMLElement
The active (focused) element in the document.
Gets the x,y coordinates to align this element with another element. See alignTo for more info on the supported position values.
Defined in override Ext.dom.Element_alignment.
Available since: 1.1.0
Parameters
- element : String/HTMLElement/Ext.Element
The element to align to.
- position : String (optional)
The position to align to (defaults to )
Defaults to:
"tl-bl?" - offsets : Number[] (optional)
Offset the positioning by [x, y]
Returns
- Number[]
[x, y]
Overrides: Ext.dom.AbstractElement.getAlignToXY
private
Defined in override Ext.dom.AbstractElement_alignment.
Available since: 4.1.2
Gets the x,y coordinates specified by the anchor position on the element.
Defined in override Ext.dom.Element_alignment.
Available since: 1.1.0
Parameters
- anchor : String (optional)
The specified anchor position. See alignTo for details on supported anchor positions.
Defaults to:
'c' - local : Boolean (optional)
True to get the local (element top/left-relative) anchor position instead of page coordinates
- size : Object (optional)
An object containing the size to use for calculating anchor position {width: (target width), height: (target height)} (defaults to the element's current size)
Returns
- Number[]
[x, y] An array containing the element's x and y coordinates
Overrides: Ext.dom.AbstractElement.getAnchorXY
Gets the width of the border(s) for the specified side(s)
Defined in override Ext.dom.AbstractElement_style.
Available since: 4.1.0
Parameters
- side : String
Can be t, l, r, b or any combination of those to add multiple values. For example, passing
'lr'would get the border left width + the border right width.
Returns
- Number
The width of the sides passed added together
Return an object defining the area of this Element which can be passed to setBox to set another Element's size/location to match this element.
Defined in override Ext.dom.AbstractElement_position.
Available since: 4.1.0
Parameters
- contentBox : Boolean (optional)
If true a box for the content of the element is returned.
- local : Boolean (optional)
If true the element's left and top are returned instead of page x/y.
Returns
- Object
box An object in the format:
{ x: <Element's X position>, y: <Element's Y position>, width: <Element's width>, height: <Element's height>, bottom: <Element's lower bound>, right: <Element's rightmost bound> }The returned object may also be addressed as an Array where index 0 contains the X position and index 1 contains the Y position. So the result may also be used for setXY
Calculates the x, y to center this element on the screen
Defined in override Ext.dom.Element_alignment.
Available since: 1.1.0
Returns
- Number[]
The x, y values [x, y]
Return the CSS color for the specified CSS attribute. rgb, 3 digit (like #fff) and valid values
are convert to standard 6 digit hex color.
Defined in override Ext.dom.Element_style.
Available since: 1.1.0
Parameters
Returns either the offsetHeight or the height of this element based on CSS height adjusted by padding or borders when needed to simulate offsetHeight when offsets aren't available. This may not work on display:none elements if a height has not been set using CSS.
Defined in override Ext.dom.Element_style.
Available since: 1.1.0
Returns
Returns either the offsetWidth or the width of this element based on CSS width adjusted by padding or borders when needed to simulate offsetWidth when offsets aren't available. This may not work on display:none elements if a width has not been set using CSS.
Defined in override Ext.dom.Element_style.
Available since: 1.1.0
Returns
Returns the [X, Y] vector by which this element must be translated to make a best attempt
to constrain within the passed constraint. Returns false is this element does not need to be moved.
Priority is given to constraining the top and left within the constraint.
The constraint may either be an existing element into which this element is to be constrained, or an Region into which this element is to be constrained.
Defined in override Ext.dom.Element_alignment.
Available since: 4.0.0
Parameters
- constrainTo : Ext.Element/Ext.util.Region
The Element or Region into which this element is to be constrained.
- proposedPosition : Number[]
A proposed
[X, Y]position to test for validity and to produce a vector for instead of using this Element's current position;
Returns
Returns the innerHTML of an Element or an empty string if the element's dom no longer exists.
Available since: 4.1.0
Returns the x-coordinate of this element relative to its offsetParent.
Defined in override Ext.dom.Element_position.
Available since: 4.1.1
Returns
- Number
The local x-coordinate (relative to the
offsetParent).
Returns the y-coordinate of this element relative to its offsetParent.
Defined in override Ext.dom.Element_position.
Available since: 4.1.1
Returns
- Number
The local y-coordinate (relative to the
offsetParent).
Returns an object with properties top, left, right and bottom representing the margins of this element unless sides is passed, then it returns the calculated width of the sides (see getPadding)
Defined in override Ext.dom.AbstractElement_style.
Available since: 4.1.0
Parameters
- sides : String (optional)
Any combination of l, r, t, b to get the sum of those sides
Returns
Returns the offsets of this element from the passed element. Both element must be part of the DOM tree and not have display:none to have page coordinates.
Defined in override Ext.dom.Element_position.
Available since: 2.3.0
Parameters
- element : String/HTMLElement/Ext.Element
The element to get the offsets from.
Returns
- Number[]
The XY page offsets (e.g.
[100, -200])
Overrides: Ext.dom.AbstractElement.getOffsetsTo
Gets the width of the padding(s) for the specified side(s)
Defined in override Ext.dom.AbstractElement_style.
Available since: 4.1.0
Parameters
- side : String
Can be t, l, r, b or any combination of those to add multiple values. For example, passing
'lr'would get the padding left + the padding right.
Returns
- Number
The padding of the sides passed added together
Return an object defining the area of this Element which can be passed to setBox to set another Element's size/location to match this element.
Defined in override Ext.dom.AbstractElement_position.
Available since: 4.1.0
Parameters
- asRegion : Boolean (optional)
If true an Ext.util.Region will be returned
Returns
- Object
box An object in the format
{ left: <Element's X position>, top: <Element's Y position>, width: <Element's width>, height: <Element's height>, bottom: <Element's lower bound>, right: <Element's rightmost bound> }The returned object may also be addressed as an Array where index 0 contains the X position and index 1 contains the Y position. So the result may also be used for setXY
Gets an object with all CSS positioning properties. Useful along with #setPostioning to get snapshot before performing an update and then restoring the element.
Defined in override Ext.dom.Element_position.
Available since: 1.1.0
Returns
Returns the region of this element. The element must be part of the DOM tree to have a region (display:none or elements not appended return false).
Defined in override Ext.dom.Element_position.
Available since: 1.1.0
Returns
- Ext.util.Region
A Region containing "top, left, bottom, right" member data.
Creates a function to call to clean up problems with the work-around for the WebKit RightMargin bug. The work-around is to add "display: 'inline-block'" to the element before calling getComputedStyle and then to restore its original display value. The problem with this is that it corrupts the selection of an INPUT or TEXTAREA element (as in the "I-beam" goes away but ths focus remains). To cleanup after this, we need to capture the selection of any such element and then restore it after we have restored the display style.
Defined in override Ext.dom.AbstractElement_static.
Available since: 4.1.0
Parameters
- target : Ext.dom.Element
The top-most element being adjusted.
Gets the parent node of the current element taking into account Ext.scopeResetCSS
Available since: 4.0.6
Returns
- HTMLElement
The parent element
Returns the current scroll position of the element.
Defined in override Ext.dom.Element_scroll.
Available since: 1.1.0
Returns
- Object
An object containing the scroll position in the format
{left: (scrollLeft), top: (scrollTop)}
Returns a named style property based on computed/currentStyle (primary) and inline-style if primary is not available.
Defined in override Ext.dom.AbstractElement_style.
Available since: 4.1.0
Parameters
- property : String/String[]
The style property (or multiple property names in an array) whose value is returned.
- inline : Boolean (optional)
if
trueonly inline styles will be returned.Defaults to:
false
Returns
Returns the dimensions of the element available to lay content out in.
getStyleSize utilizes prefers style sizing if present, otherwise it chooses the larger of offsetHeight/clientHeight and offsetWidth/clientWidth. To obtain the size excluding scrollbars, use getViewSize.
Sizing of the document body is handled at the adapter level which handles special cases for IE and strict modes, etc.
Defined in override Ext.dom.Element_style.
Available since: 3.4.0
Returns
Returns the width in pixels of the passed text, or the width of the text in this Element.
Available since: 2.3.0
Parameters
- text : String
The text to measure. Defaults to the innerHTML of the element.
- min : Number (optional)
The minumum value to return.
- max : Number (optional)
The maximum value to return.
Returns
- Number
The text width in pixels.
Returns the content region of this element. That is the region within the borders and padding.
Defined in override Ext.dom.Element_position.
Available since: 4.0.0
Returns
- Ext.util.Region
A Region containing "top, left, bottom, right" member data.
Returns the dimensions of the element available to lay content out in.
If the element (or any ancestor element) has CSS style display: none, the dimensions will be zero.
Example:
var vpSize = Ext.getBody().getViewSize();
// all Windows created afterwards will have a default value of 90% height and 95% width
Ext.Window.override({
width: vpSize.width * 0.9,
height: vpSize.height * 0.95
});
// To handle window resizing you would have to hook onto onWindowResize.
getViewSize utilizes clientHeight/clientWidth which excludes sizing of scrollbars. To obtain the size including scrollbars, use getStyleSize
Sizing of the document body is handled at the adapter level which handles special cases for IE and strict modes, etc.
Defined in override Ext.dom.AbstractElement_style.
Available since: 4.1.0
Returns
Gets the current X position of the element based on page coordinates. Element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
Defined in override Ext.dom.AbstractElement_position.
Available since: 4.1.0
Parameters
- el : Object
Returns
- Number
The X position of the element
Gets the current position of the element based on page coordinates. Element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
Defined in override Ext.dom.Element_position.
Available since: 1.1.0
Returns
- Number[]
The XY position of the element
Overrides: Ext.dom.AbstractElement.getXY
Gets the current Y position of the element based on page coordinates. Element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
Defined in override Ext.dom.AbstractElement_position.
Available since: 4.1.0
Parameters
- el : Object
Returns
- Number
The Y position of the element
Slides the element while fading it out of view. An anchor point can be optionally passed to set the ending point of the effect. Usage:
// default: slide the element downward while fading out
el.ghost();
// custom: slide the element out to the right with a 2-second duration
el.ghost('r', { duration: 2000 });
// common config options shown with default values
el.ghost('b', {
easing: 'easeOut',
duration: 500
});
Defined in override Ext.dom.Element_anim.
Available since: 4.0.0
Parameters
- anchor : String (optional)
One of the valid Fx anchor positions (defaults to bottom: 'b')
- options : Object (optional)
Object literal with any of the Fx config options
Returns
- Ext.dom.Element
The Element
Determine if the Element has a relevant height and width available based upon current logical visibility state
Defined in override Ext.dom.Element_fx.
Available since: 3.4.0
Hide this element - Uses display mode to determine whether to use "display" or "visibility". See setVisible.
Defined in override Ext.dom.Element_fx.
Available since: 1.1.0
Parameters
- animate : Boolean/Object (optional)
true for the default animation or a standard Element animation config object
Returns
- Ext.dom.Element
this
Overrides: Ext.dom.AbstractElement.hide
Highlights the Element by setting a color (applies to the background-color by default, but can be changed using the "attr" config option) and then fading back to the original color. If no original color is available, you should provide the "endColor" config option which will be cleared after the animation. Usage:
// default: highlight background to yellow
el.highlight();
// custom: highlight foreground text to blue for 2 seconds
el.highlight("0000ff", { attr: 'color', duration: 2000 });
// common config options shown with default values
el.highlight("ffff9c", {
attr: "backgroundColor", //can be any valid CSS property (attribute) that supports a color value
endColor: (current color) or "ffffff",
easing: 'easeIn',
duration: 1000
});
Defined in override Ext.dom.Element_anim.
Available since: 4.0.0
Parameters
- color : String (optional)
The highlight color. Should be a 6 char hex color without the leading # (defaults to yellow: 'ffff9c')
- options : Object (optional)
Object literal with any of the Fx config options
Returns
- Ext.dom.Element
The Element
Sets up event handlers to call the passed functions when the mouse is moved into and out of the Element.
Available since: 2.3.0
Parameters
- overFn : Function
The function to call when the mouse enters the Element.
- outFn : Function
The function to call when the mouse leaves the Element.
- scope : Object (optional)
The scope (
thisreference) in which the functions are executed. Defaults to the Element's DOM element. - options : Object (optional)
Options for the listener. See the options parameter.
Returns
- Ext.dom.Element
this
Initialize configuration for this class. a typical example:
Ext.define('My.awesome.Class', {
// The default config
config: {
name: 'Awesome',
isAwesome: true
},
constructor: function(config) {
this.initConfig(config);
}
});
var awesome = new My.awesome.Class({
name: 'Super Awesome'
});
alert(awesome.getName()); // 'Super Awesome'
Available since: 4.0.0
Parameters
- config : Object
Returns
- Ext.Base
this
Initializes a Ext.dd.DD drag drop object for this element.
Defined in override Ext.dom.Element_dd.
Available since: 1.1.0
Parameters
- group : String
The group the DD object is member of
- config : Object
The DD config object
- overrides : Object
An object containing methods to override/implement on the DD object
Returns
- Ext.dd.DD
The DD object
Initializes a Ext.dd.DDProxy object for this element.
Defined in override Ext.dom.Element_dd.
Available since: 1.1.0
Parameters
- group : String
The group the DDProxy object is member of
- config : Object
The DDProxy config object
- overrides : Object
An object containing methods to override/implement on the DDProxy object
Returns
- Ext.dd.DDProxy
The DDProxy object
Initializes a Ext.dd.DDTarget object for this element.
Defined in override Ext.dom.Element_dd.
Available since: 1.1.0
Parameters
- group : String
The group the DDTarget object is member of
- config : Object
The DDTarget config object
- overrides : Object
An object containing methods to override/implement on the DDTarget object
Returns
- Ext.dd.DDTarget
The DDTarget object
Inserts this element after the passed element in the DOM
Defined in override Ext.dom.AbstractElement_insertion.
Available since: 4.1.0
Parameters
- el : String/HTMLElement/Ext.dom.AbstractElement
The element to insert after. The id of the node, a DOM Node or an existing Element.
Returns
- Ext.dom.AbstractElement
This element
Inserts this element before the passed element in the DOM
Defined in override Ext.dom.AbstractElement_insertion.
Available since: 4.1.0
Parameters
- el : String/HTMLElement/Ext.dom.AbstractElement
The element before which this element will be inserted. The id of the node, a DOM Node or an existing Element.
Returns
- Ext.dom.AbstractElement
This element
Inserts (or creates) an element (or DomHelper config) as the first child of this element
Defined in override Ext.dom.AbstractElement_insertion.
Available since: 4.1.0
Parameters
- el : String/HTMLElement/Ext.dom.AbstractElement/Object
The id or element to insert or a DomHelper config to create and insert
Returns
- Ext.dom.AbstractElement
The new child
Inserts an html fragment into this element
Defined in override Ext.dom.AbstractElement_insertion.
Available since: 4.1.0
Parameters
- where : String
Where to insert the html in relation to this element - beforeBegin, afterBegin, beforeEnd, afterEnd. See Ext.dom.Helper.insertHtml for details.
- html : String
The HTML fragment
- returnEl : Boolean (optional)
True to return an Ext.dom.AbstractElement
Defaults to:
false
Returns
- HTMLElement/Ext.dom.AbstractElement
The inserted node (or nearest related if more than 1 inserted)
Inserts (or creates) the passed element (or DomHelper config) as a sibling of this element
Defined in override Ext.dom.AbstractElement_insertion.
Available since: 4.1.0
Parameters
- el : String/HTMLElement/Ext.dom.AbstractElement/Object/Array
The id, element to insert or a DomHelper config to create and insert or an array of any of those.
- where : String (optional)
'before' or 'after'
Defaults to:
'before' - returnDom : Boolean (optional)
True to return the .;ll;l,raw DOM element instead of Ext.dom.AbstractElement
Defaults to:
false
Returns
- Ext.dom.AbstractElement
The inserted Element. If an array is passed, the last inserted element is returned.
Defined in override Ext.dom.AbstractElement_traversal.
Available since: 4.1.2
Parameters
- element : Object
Tests various css rules/browsers to determine if this element uses a border box
Available since: 1.1.0
Returns
Returns true if this element is masked. Also re-centers any displayed message within the mask.
Available since: 1.1.0
Returns
Returns true if this element is scrollable.
Defined in override Ext.dom.Element_scroll.
Available since: 1.1.0
Returns
Returns true if the value of the given property is visually transparent. This may be due to a 'transparent' style value or an rgba value with 0 in the alpha component.
Defined in override Ext.dom.AbstractElement_style.
Available since: 4.1.0
Parameters
- prop : String
The style property whose value is to be tested.
Returns
- Boolean
True if the style property is visually transparent.
Checks whether the element is currently visible using both visibility and display properties.
Available since: 1.1.0
Parameters
- deep : Boolean (optional)
True to walk the dom and see if parent elements are hidden. If false, the function only checks the visibility of the element itself and it may return
trueeven though a parent is not visible.Defaults to:
false
Returns
- Boolean
trueif the element is currently visible, elsefalse
Gets the last child, skipping text nodes
Defined in override Ext.dom.AbstractElement_traversal.
Available since: 4.1.0
Parameters
- selector : String (optional)
Find the previous sibling that matches the passed simple selector
- returnDom : Boolean (optional)
True to return a raw dom node instead of an Ext.dom.Element
Defaults to:
false
Returns
- Ext.dom.Element/HTMLElement
The last child or null
Direct access to the Ext.ElementLoader Ext.ElementLoader.load method. The method takes the same object parameter as Ext.ElementLoader.load
Available since: 1.1.0
Parameters
- options : Object
Returns
- Ext.dom.Element
this
Puts a mask over this element to disable user interaction. Requires core.css. This method can only be applied to elements which accept child nodes.
Available since: 1.1.0
Parameters
- msg : String (optional)
A message to display in the mask
- msgCls : String (optional)
A css class to apply to the msg element
Returns
- Ext.dom.Element
The mask element
Overrides: Ext.dom.AbstractElement.mask
Monitors this Element for the mouse leaving. Calls the function after the specified delay only if the mouse was not moved back into the Element within the delay. If the mouse was moved back in, the function is not called.
Available since: 4.0.0
Parameters
- delay : Number
The delay in milliseconds to wait for possible mouse re-entry before calling the handler function.
- handler : Function
The function to call if the mouse remains outside of this Element for the specified time.
- scope : Object (optional)
The scope (
thisreference) in which the handler function executes. Defaults to this Element.
Returns
- Object
The listeners object which was added to this element so that monitoring can be stopped. Example usage:
// Hide the menu if the mouse moves out for 250ms or more this.mouseLeaveMonitor = this.menuEl.monitorMouseLeave(250, this.hideMenu, this); ... // Remove mouseleave monitor on menu destroy this.menuEl.un(this.mouseLeaveMonitor);
Move this element relative to its current position.
Defined in override Ext.dom.Element_position.
Available since: 1.1.0
Parameters
Sets the position of the element in page coordinates, regardless of how the element
is positioned. The element must be part of the DOM tree to have page coordinates
(display:none or elements not appended return false).
Defined in override Ext.dom.Element_position.
Available since: 1.1.0
Parameters
- x : Number
X value for new position (coordinates are page-based)
- y : Number
Y value for new position (coordinates are page-based)
- animate : Boolean/Object (optional)
True for the default animation, or a standard Element animation config object
Returns
Returns true if this element needs an explicit tabIndex to make it focusable. Input fields, text areas, buttons anchors elements with an href etc do not need a tabIndex, but structural elements do.
Available since: 4.1.0
Gets the next sibling, skipping text nodes
Defined in override Ext.dom.AbstractElement_traversal.
Available since: 4.1.0
Parameters
- selector : String (optional)
Find the next sibling that matches the passed simple selector
- returnDom : Boolean (optional)
True to return a raw dom node instead of an Ext.dom.Element
Defaults to:
false
Returns
- Ext.dom.Element/HTMLElement
The next sibling or null
Appends an event handler to this element.
Available since: 1.1.0
Parameters
- eventName : String
The name of event to handle.
- fn : Function
The handler function the event invokes. This function is passed the following parameters:
evt : EventObject
The EventObject describing the event.
el : HtmlElement
The DOM 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 call that setup the listener.
- scope : Object (optional)
The scope (this reference) in which the handler function is executed. If omitted, defaults to this 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. If omitted, defaults to this Element.
delegate String:
A simple selector to filter the target or look for a descendant of the target. See below for additional details.
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
target Ext.dom.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.
delay Number:
The number of milliseconds to delay the invocation of the handler after the 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.
Combining Options
Using the options argument, it is possible to combine different types of listeners:
A delayed, one-time listener that auto stops the event and adds a custom argument (forumId) to the options object. The options object is available as the third parameter in the handler function.
Code:
el.on('click', this.onClick, this, { single: true, delay: 100, stopEvent : true, forumId: 4 });Attaching multiple handlers in 1 call
The method also allows for a single argument to be passed which is a config object containing properties which specify multiple handlers.
Code:
el.on({ 'click' : { fn: this.onClick, scope: this, delay: 100 }, 'mouseover' : { fn: this.onMouseOver, scope: this }, 'mouseout' : { fn: this.onMouseOut, scope: this } });Or a shorthand syntax:
Code:
el.on({ 'click' : this.onClick, 'mouseover' : this.onMouseOver, 'mouseout' : this.onMouseOut, scope: this });delegate
This is a configuration option that you can pass along when registering a handler for an event to assist with event delegation. Event delegation is a technique that is used to reduce memory consumption and prevent exposure to memory-leaks. By registering an event for a container element as opposed to each element within a container. By setting this configuration option to a simple selector, the target element will be filtered to look for a descendant of the target. For example:
// using this markup: <div id='elId'> <p id='p1'>paragraph one</p> <p id='p2' class='clickable'>paragraph two</p> <p id='p3'>paragraph three</p> </div> // utilize event delegation to registering just one handler on the container element: el = Ext.get('elId'); el.on( 'click', function(e,t) { // handle click console.info(t.id); // 'p2' }, this, { // filter the target element to be a descendant with the class 'clickable' delegate: '.clickable' } );
Returns
- Ext.dom.Element
this
Gets the parent node for this element, optionally chaining up trying to match a selector
Defined in override Ext.dom.AbstractElement_traversal.
Available since: 4.1.0
Parameters
- selector : String (optional)
Find a parent node that matches the passed simple selector
- returnDom : Boolean (optional)
True to return a raw dom node instead of an Ext.dom.Element
Defaults to:
false
Returns
- Ext.dom.Element/HTMLElement
The parent node or null
Creates a pause before any subsequent queued effects begin. If there are no effects queued after the pause it will have no effect. Usage:
el.pause(1);
Defined in override Ext.dom.Element_anim.
This method has been deprecated since 4.0
Use the delay config to animate instead.
Available since: 4.0.0
Parameters
- seconds : Number
The length of time to pause (in seconds)
Returns
- Ext.Element
The Element
Initializes positioning on this element. If a desired position is not passed, it will make the the element positioned relative IF it is not already positioned.
Defined in override Ext.dom.Element_position.
Available since: 1.1.0
Parameters
Gets the previous sibling, skipping text nodes
Defined in override Ext.dom.AbstractElement_traversal.
Available since: 4.1.0
Parameters
- selector : String (optional)
Find the previous sibling that matches the passed simple selector
- returnDom : Boolean (optional)
True to return a raw dom node instead of an Ext.dom.Element
Defaults to:
false
Returns
- Ext.dom.Element/HTMLElement
The previous sibling or null
Fades the element out while slowly expanding it in all directions. When the effect is completed, the element will be hidden (visibility = 'hidden') but block elements will still take up space in the document. Usage:
// default
el.puff();
// common config options shown with default values
el.puff({
easing: 'easeOut',
duration: 500,
useDisplay: false
});
Defined in override Ext.dom.Element_anim.
Available since: 4.0.0
Parameters
- options : Object (optional)
Object literal with any of the Fx config options
Returns
- Ext.dom.Element
The Element
Recursively removes all previous added listeners from this element and its children
Available since: 3.4.0
Returns
- Ext.dom.Element
this
Selects child nodes based on the passed CSS selector (the selector should not contain an id).
Defined in override Ext.dom.AbstractElement_traversal.
Available since: 4.1.0
Parameters
- selector : String
The CSS selector
Returns
- HTMLElement[]
An array of the matched nodes
Adds one or more CSS classes to this element and removes the same class(es) from all siblings.
Defined in override Ext.dom.AbstractElement_style.
Available since: 4.1.0
Parameters
Returns
- Ext.dom.Element
this
Create an event handler on this element such that when the event fires and is handled by this element, it will be relayed to another object (i.e., fired again as if it originated from that object instead).
Available since: 1.1.0
Parameters
- eventName : String
The type of event to relay
- observable : Object
Any object that extends Ext.util.Observable that will provide the context for firing the relayed event
Removes this element's dom reference. Note that event and cache removal is handled at Ext.removeNode
Available since: 4.1.0
Removes all previous added listeners from this element
Available since: 1.1.0
Returns
- Ext.dom.Element
this
Remove any anchor to this element. See anchorTo.
Defined in override Ext.dom.Element_alignment.
Available since: 3.4.0
Returns
- Ext.dom.Element
this
Removes one or more CSS classes from the element.
Defined in override Ext.dom.AbstractElement_style.
Available since: 4.1.0
Parameters
Returns
- Ext.dom.Element
this
Shorthand for un.
Removes an event handler from this element.
Note: if a scope was explicitly specified when adding the listener, the same scope must be specified here.
Example:
el.un('click', this.handlerFn);
// or
el.removeListener('click', this.handlerFn);
Available since: 1.1.0
Parameters
- eventName : String
The name of the event from which to remove the handler.
- fn : Function
The handler function to remove. This must be a reference to the function passed into the on call.
- scope : Object
If a scope (this reference) was specified when the listener was added, then this must refer to the same object.
Returns
- Ext.dom.Element
this
Forces the browser to repaint this element
Defined in override Ext.dom.AbstractElement_style.
Available since: 4.1.0
Returns
- Ext.dom.Element
this
Replaces the passed element with this element
Defined in override Ext.dom.AbstractElement_insertion.
Available since: 4.1.0
Parameters
- el : String/HTMLElement/Ext.dom.AbstractElement
The element to replace. The id of the node, a DOM Node or an existing Element.
Returns
- Ext.dom.AbstractElement
This element
Replaces a CSS class on the element with another. If the old name does not exist, the new name will simply be added.
Defined in override Ext.dom.AbstractElement_style.
Available since: 4.1.0
Parameters
Returns
- Ext.dom.Element
this
Replaces this element with the passed element
Defined in override Ext.dom.AbstractElement_insertion.
Available since: 4.1.0
Parameters
- el : String/HTMLElement/Ext.dom.AbstractElement/Object
The new element (id of the node, a DOM Node or an existing Element) or a DomHelper config of an element to create
Returns
- Ext.dom.AbstractElement
This element
Animates the transition of an element's dimensions from a starting height/width to an ending height/width. This method is a convenience implementation of shift. Usage:
// change height and width to 100x100 pixels
el.scale(100, 100);
// common config options shown with default values. The height and width will default to
// the element's existing values if passed as null.
el.scale(
[element's width],
[element's height], {
easing: 'easeOut',
duration: 350
}
);
Defined in override Ext.dom.Element_anim.
This method has been deprecated since 4.0
Just use animate instead.
Available since: 4.0.0
Parameters
- width : Number
The new width (pass undefined to keep the original width)
- height : Number
The new height (pass undefined to keep the original height)
- options : Object (optional)
Object literal with any of the Fx config options
Returns
- Ext.Element
The Element
Scrolls this element the specified direction. Does bounds checking to make sure the scroll is within this element's scrollable range.
Defined in override Ext.dom.Element_scroll.
Available since: 1.1.0
Parameters
- direction : String
Possible values are:
"l"(or"left")"r"(or"right")"t"(or"top", or"up")"b"(or"bottom", or"down")
- distance : Number
How far to scroll the element in pixels
- animate : Boolean/Object (optional)
true for the default animation or a standard Element animation config object
Returns
- Boolean
Returns true if a scroll was triggered or false if the element was scrolled as far as it could go.
Scrolls this element by the passed delta values, optionally animating.
All of the following are equivalent:
el.scrollBy(10, 10, true);
el.scrollBy([10, 10], true);
el.scrollBy({ x: 10, y: 10 }, true);
Defined in override Ext.dom.Element_scroll.
Available since: 4.1.0
Parameters
- deltaX : Number/Number[]/Object
Either the x delta, an Array specifying x and y deltas or an object with "x" and "y" properties.
- deltaY : Number/Boolean/Object
Either the y delta, or an animate flag or config object.
- animate : Boolean/Object
Animate flag/config object if the delta values were passed separately.
Returns
- Ext.Element
this
Scrolls this element into view within the passed container.
Defined in override Ext.dom.Element_scroll.
Available since: 1.1.0
Parameters
- container : String/HTMLElement/Ext.Element (optional)
The container element to scroll. Should be a string (id), dom node, or Ext.Element.
Defaults to:
document.body - hscroll : Boolean (optional)
False to disable horizontal scroll.
Defaults to:
true - animate : Boolean/Object (optional)
true for the default animation or a standard Element animation config object
Returns
- Ext.dom.Element
this
Scrolls this element the specified scroll point. It does NOT do bounds checking so if you scroll to a weird value it will try to do it. For auto bounds checking, use scroll.
Defined in override Ext.dom.Element_scroll.
Available since: 1.1.0
Parameters
- side : String
Either "left" for scrollLeft values or "top" for scrollTop values.
- value : Number
The new scroll value
- animate : Boolean/Object (optional)
true for the default animation or a standard Element animation config object
Returns
- Ext.Element
this
Creates a Ext.CompositeElement for child nodes based on the passed CSS selector (the selector should not contain an id).
Defined in override Ext.dom.AbstractElement_traversal.
Available since: 4.1.0
Parameters
- selector : String
The CSS selector
- unique : Boolean (optional)
True to create a unique Ext.Element for each element. Defaults to a shared flyweight object.
Returns
- Ext.CompositeElement
The composite element
Enable text selection for this element (normalized across browsers)
Defined in override Ext.dom.Element_style.
Available since: 4.0.6
Returns
- Ext.Element
this
Sets the passed attributes as attributes of this element (a style attribute can be a string, object or function)
Available since: 4.1.0
Parameters
- o : Object
The object with the attributes
- useSet : Boolean (optional)
false to override the default setAttribute to use expandos.
Defaults to:
true
Returns
- Ext.dom.Element
this
Sets the element's CSS bottom style.
Defined in override Ext.dom.AbstractElement_position.
Available since: 4.1.0
Parameters
- bottom : String
The bottom CSS property value
Returns
Sets the element's position and size in one shot. If animation is true then width, height, x and y will be animated concurrently.
Defined in override Ext.dom.Element_position.
Available since: 1.1.0
Parameters
- x : Number
X value for new position (coordinates are page-based)
- y : Number
Y value for new position (coordinates are page-based)
- width : Number/String
The new width. This may be one of:
- A Number specifying the new width in this Element's defaultUnits (by default, pixels)
- A String used to set the CSS width style. Animation may not be used.
- height : Number/String
The new height. This may be one of:
- A Number specifying the new height in this Element's defaultUnits (by default, pixels)
- A String used to set the CSS height style. Animation may not be used.
- animate : Boolean/Object (optional)
true for the default animation or a standard Element animation config object
Returns
Sets the element's box. Use getBox() on another element to get a box obj. If animate is true then width, height, x and y will be animated concurrently.
Defined in override Ext.dom.AbstractElement_position.
Available since: 4.1.0
Parameters
- box : Object
The box to fill {x, y, width, height}
- adjust : Boolean (optional)
Whether to adjust for box-model issues automatically
- animate : Boolean/Object (optional)
true for the default animation or a standard Element animation config object
Returns
Sets the CSS display property. Uses originalDisplay if the specified value is a boolean true.
Defined in override Ext.dom.Element_fx.
Available since: 1.1.0
Parameters
- value : Boolean/String
Boolean value to display the element using its default display, or a string to set the display directly.
Returns
- Ext.dom.Element
this
Set the innerHTML of this element
Available since: 4.1.0
Parameters
- html : String
The new HTML
Returns
- Ext.Element
this
Set the height of this Element.
// change the height to 200px and animate with default configuration
Ext.fly('elementId').setHeight(200, true);
// change the height to 150px and animate with a custom configuration
Ext.fly('elId').setHeight(150, {
duration : 500, // animation will have a duration of .5 seconds
// will change the content to "finished"
callback: function(){ this.update("finished"); }
});
Defined in override Ext.dom.AbstractElement_style.
Available since: 4.1.0
Parameters
- height : Number/String
The new height. This may be one of:
- A Number specifying the new height in this Element's defaultUnits (by default, pixels.)
- A String used to set the CSS height style. Animation may not be used.
- animate : Boolean/Object (optional)
true for the default animation or a standard Element animation config object
Returns
- Ext.dom.Element
this
Removes "vertical" state from this element (reverses everything done by setVertical).
Defined in override Ext.dom.Element_style.
Available since: Ext JS 4.1.3
Conveniently sets left and top adding default units.
Defined in override Ext.dom.Element_position.
Available since: 1.1.0
Parameters
Returns
- Ext.dom.Element
this
Sets the position of the element in page coordinates, regardless of how the element
is positioned. The element must be part of the DOM tree to have page coordinates
(display:none or elements not appended return false).
Defined in override Ext.dom.Element_position.
Available since: 1.1.0
Parameters
- x : Number
X value for new position (coordinates are page-based)
- y : Number
Y value for new position (coordinates are page-based)
- animate : Boolean/Object (optional)
True for the default animation, or a standard Element animation config object
Returns
Set the opacity of the element
Defined in override Ext.dom.Element_style.
Available since: 1.1.0
Parameters
- opacity : Number
The new opacity. 0 = transparent, .5 = 50% visibile, 1 = fully visible, etc
- animate : Boolean/Object (optional)
a standard Element animation config object or
truefor the default animation ({duration: 350, easing: 'easeIn'})
Returns
- Ext.dom.Element
this
Set positioning with an object returned by getPositioning.
Defined in override Ext.dom.Element_position.
Available since: 1.1.0
Parameters
- posCfg : Object
Returns
Sets the element's position and size the specified region. If animation is true then width, height, x and y will be animated concurrently.
Defined in override Ext.dom.Element_position.
Available since: 1.1.0
Parameters
- region : Ext.util.Region
The region to fill
- animate : Boolean/Object (optional)
true for the default animation or a standard Element animation config object
Returns
Sets the element's CSS right style.
Defined in override Ext.dom.AbstractElement_position.
Available since: 4.1.0
Parameters
- right : String
The right CSS property value
Returns
Set the size of this Element. If animation is true, both width and height will be animated concurrently.
Defined in override Ext.dom.AbstractElement_style.
Available since: 4.1.0
Parameters
- width : Number/String
The new width. This may be one of:
- A Number specifying the new width in this Element's defaultUnits (by default, pixels).
- A String used to set the CSS width style. Animation may not be used.
- A size object in the format
{width: widthValue, height: heightValue}.
- height : Number/String
The new height. This may be one of:
- A Number specifying the new height in this Element's defaultUnits (by default, pixels).
- A String used to set the CSS height style. Animation may not be used.
- animate : Boolean/Object (optional)
true for the default animation or a standard Element animation config object
Returns
- Ext.dom.Element
this
Wrapper for setting style properties, also takes single object parameter of multiple styles.
Defined in override Ext.dom.AbstractElement_style.
Available since: 4.1.0
Parameters
- property : String/Object
The style property to be set, or an object of multiple styles.
- value : String (optional)
The value to apply to the given property, or null if an object was passed.
Returns
- Ext.dom.Element
this
Changes this Element's state to "vertical" (rotated 90 or 270 degrees). This involves inverting the getters and setters for height and width (getWidth becomes getHeight and vice versa), setStyle and getStyle will also return the inverse when height or width are being operated on.
Defined in override Ext.dom.Element_style.
Available since: Ext JS 4.1.3
Parameters
- cls : String
an optional css class that contains the required styles for switching the element to vertical orientation. Omit this if the element already contains vertical styling. If cls is provided, it will be removed from the element when setHorizontal is called.
Use this to change the visibility mode between VISIBILITY, DISPLAY, OFFSETS or ASCLASS.
Available since: 4.1.0
Parameters
- mode : Object
Returns
Sets the visibility of the element (see details). If the visibilityMode is set to Element.DISPLAY, it will use the display property to hide the element, otherwise it uses visibility. The default is to hide and show using the visibility property.
Defined in override Ext.dom.Element_fx.
Available since: 1.1.0
Parameters
- visible : Boolean
Whether the element is visible
- animate : Boolean/Object (optional)
True for the default animation, or a standard Element animation config object
Returns
- Ext.dom.Element
this
Overrides: Ext.dom.AbstractElement.setVisible
Set the width of this Element.
Defined in override Ext.dom.AbstractElement_style.
Available since: 4.1.0
Parameters
- width : Number/String
The new width. This may be one of:
- A Number specifying the new width in this Element's defaultUnits (by default, pixels).
- A String used to set the CSS width style. Animation may not be used.
- animate : Boolean/Object (optional)
true for the default animation or a standard Element animation config object
Returns
- Ext.dom.Element
this
Sets the X position of the element based on page coordinates. Element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
Defined in override Ext.dom.AbstractElement_position.
Available since: 4.1.0
Parameters
- The : Number
X position of the element
- animate : Boolean/Object (optional)
True for the default animation, or a standard Element animation config object
Returns
Sets the position of the element in page coordinates, regardless of how the element
is positioned. The element must be part of the DOM tree to have page coordinates
(display:none or elements not appended return false).
Defined in override Ext.dom.Element_position.
Available since: 1.1.0
Parameters
- pos : Number[]
Contains X & Y [x, y] values for new position (coordinates are page-based)
- animate : Boolean/Object (optional)
True for the default animation, or a standard Element animation config object
Returns
- Ext.Element
this
Overrides: Ext.dom.AbstractElement.setXY
Sets the Y position of the element based on page coordinates. Element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
Defined in override Ext.dom.AbstractElement_position.
Available since: 4.1.0
Parameters
- The : Number
Y position of the element
- animate : Boolean/Object (optional)
True for the default animation, or a standard Element animation config object
Returns
Animates the transition of any combination of an element's dimensions, xy position and/or opacity. Any of these properties not specified in the config object will not be changed. This effect requires that at least one new dimension, position or opacity setting must be passed in on the config object in order for the function to have any effect. Usage:
// slide the element horizontally to x position 200 while changing the height and opacity
el.shift({ x: 200, height: 50, opacity: .8 });
// common config options shown with default values.
el.shift({
width: [element's width],
height: [element's height],
x: [element's x position],
y: [element's y position],
opacity: [element's opacity],
easing: 'easeOut',
duration: 350
});
Defined in override Ext.dom.Element_anim.
This method has been deprecated since 4.0
Just use animate instead.
Available since: 4.0.0
Parameters
- options : Object
Object literal with any of the Fx config options
Returns
- Ext.Element
The Element
Show this element - Uses display mode to determine whether to use "display" or "visibility". See setVisible.
Defined in override Ext.dom.Element_fx.
Available since: 1.1.0
Parameters
- animate : Boolean/Object (optional)
true for the default animation or a standard Element animation config object
Returns
- Ext.dom.Element
this
Overrides: Ext.dom.AbstractElement.show
Slides the element into view. An anchor point can be optionally passed to set the point of origin for the slide effect. This function automatically handles wrapping the element with a fixed-size container if needed. See the Fx class overview for valid anchor point options. Usage:
// default: slide the element in from the top
el.slideIn();
// custom: slide the element in from the right with a 2-second duration
el.slideIn('r', { duration: 2000 });
// common config options shown with default values
el.slideIn('t', {
easing: 'easeOut',
duration: 500
});
Defined in override Ext.dom.Element_anim.
Available since: 4.0.0
Parameters
- anchor : String (optional)
One of the valid Fx anchor positions (defaults to top: 't')
- options : Object (optional)
Object literal with any of the Fx config options
- preserveScroll : Boolean
Set to true if preservation of any descendant elements'
scrollTopvalues is required. By default the DOM wrapping operation performed byslideInandslideOutcauses the browser to lose all scroll positions.
- preserveScroll : Boolean
Returns
- Ext.dom.Element
The Element
Slides the element out of view. An anchor point can be optionally passed to set the end point for the slide effect. When the effect is completed, the element will be hidden (visibility = 'hidden') but block elements will still take up space in the document. The element must be removed from the DOM using the 'remove' config option if desired. This function automatically handles wrapping the element with a fixed-size container if needed. See the Fx class overview for valid anchor point options. Usage:
// default: slide the element out to the top
el.slideOut();
// custom: slide the element out to the right with a 2-second duration
el.slideOut('r', { duration: 2000 });
// common config options shown with default values
el.slideOut('t', {
easing: 'easeOut',
duration: 500,
remove: false,
useDisplay: false
});
Defined in override Ext.dom.Element_anim.
Available since: 4.0.0
Parameters
- anchor : String (optional)
One of the valid Fx anchor positions (defaults to top: 't')
- options : Object (optional)
Object literal with any of the Fx config options
Returns
- Ext.dom.Element
The Element
Get the reference to the class from which this object was instantiated. Note that unlike self,
this.statics() is scope-independent and it always returns the class from which it was called, regardless of what
this points to during run-time
Ext.define('My.Cat', {
statics: {
totalCreated: 0,
speciesName: 'Cat' // My.Cat.speciesName = 'Cat'
},
constructor: function() {
var statics = this.statics();
alert(statics.speciesName); // always equals to 'Cat' no matter what 'this' refers to
// equivalent to: My.Cat.speciesName
alert(this.self.speciesName); // dependent on 'this'
statics.totalCreated++;
},
clone: function() {
var cloned = new this.self; // dependent on 'this'
cloned.groupName = this.statics().speciesName; // equivalent to: My.Cat.speciesName
return cloned;
}
});
Ext.define('My.SnowLeopard', {
extend: 'My.Cat',
statics: {
speciesName: 'Snow Leopard' // My.SnowLeopard.speciesName = 'Snow Leopard'
},
constructor: function() {
this.callParent();
}
});
var cat = new My.Cat(); // alerts 'Cat', then alerts 'Cat'
var snowLeopard = new My.SnowLeopard(); // alerts 'Cat', then alerts 'Snow Leopard'
var clone = snowLeopard.clone();
alert(Ext.getClassName(clone)); // alerts 'My.SnowLeopard'
alert(clone.groupName); // alerts 'Cat'
alert(My.Cat.totalCreated); // alerts 3
Available since: 4.0.0
Returns
Stops the specified event(s) from bubbling and optionally prevents the default action
Available since: 1.1.0
Parameters
- eventName : String/String[]
an event / array of events to stop from bubbling
- preventDefault : Boolean (optional)
true to prevent the default action too
Returns
- Ext.dom.Element
this
Blinks the element as if it was clicked and then collapses on its center (similar to switching off a television). When the effect is completed, the element will be hidden (visibility = 'hidden') but block elements will still take up space in the document. The element must be removed from the DOM using the 'remove' config option if desired. Usage:
// default
el.switchOff();
// all config options shown with default values
el.switchOff({
easing: 'easeIn',
duration: .3,
remove: false,
useDisplay: false
});
Defined in override Ext.dom.Element_anim.
Available since: 4.0.0
Parameters
- options : Object (optional)
Object literal with any of the Fx config options
Returns
- Ext.dom.Element
The Element
. Currently used for updating grid cells without modifying DOM structure
Synchronizes content of this Element with the content of the passed element.
Style and CSS class are copied from source into this Element, and contents are synched recursively. If a child node is a text node, the textual data is copied.
Available since: 4.1.1
Parameters
- source : Object
Toggles the element's visibility or display, depending on visibility mode.
Defined in override Ext.dom.Element_fx.
Available since: 1.1.0
Parameters
- animate : Boolean/Object (optional)
True for the default animation, or a standard Element animation config object
Returns
- Ext.dom.Element
this
Toggles the specified CSS class on this element (removes it if it already exists, otherwise adds it).
Defined in override Ext.dom.AbstractElement_style.
Available since: 4.1.0
Parameters
- className : String
The CSS class to toggle
Returns
- Ext.dom.Element
this
Translates the passed page coordinates into left/top css values for this element
Defined in override Ext.dom.AbstractElement_position.
Available since: 4.1.0
Parameters
- x : Number/Array
The page x or an array containing [x, y]
- y : Number (optional)
The page y, required if x is not an array
Returns
- Object
An object with left and top properties. e.g. {left: (value), top: (value)}
Removes an event handler from this element.
Note: if a scope was explicitly specified when adding the listener, the same scope must be specified here.
Example:
el.un('click', this.handlerFn);
// or
el.removeListener('click', this.handlerFn);
Available since: 1.1.0
Parameters
- eventName : String
The name of the event from which to remove the handler.
- fn : Function
The handler function to remove. This must be a reference to the function passed into the on call.
- scope : Object
If a scope (this reference) was specified when the listener was added, then this must refer to the same object.
Returns
- Ext.dom.Element
this
Return clipping (overflow) to original clipping before clip was called
Defined in override Ext.dom.Element_style.
Available since: 1.1.0
Returns
- Ext.dom.Element
this
Disables text selection for this element (normalized across browsers)
Defined in override Ext.dom.Element_style.
Available since: 1.1.0
Returns
- Ext.dom.Element
this
Walks up the dom looking for a parent node that matches the passed simple selector (e.g. div.some-class or span:first-child). This is a shortcut for findParentNode() that always returns an Ext.dom.Element.
Defined in override Ext.dom.AbstractElement_traversal.
Available since: 4.1.0
Parameters
- selector : String
The simple selector to test
- limit : Number/String/HTMLElement/Ext.Element (optional)
The max depth to search as a number or an element which causes the upward traversal to stop and is not considered for inclusion as the result. (defaults to 50 || document.documentElement)
Returns
- Ext.Element
The matching DOM node (or null if no match was found)
Updates the innerHTML of this element, optionally searching for and processing scripts.
Available since: 1.1.0
Parameters
- html : String
The new HTML
- loadScripts : Boolean (optional)
True to look for and process scripts (defaults to false)
- callback : Function (optional)
For async script loading you can be notified when the update completes
Returns
- Ext.dom.Element
this
Overrides: Ext.dom.AbstractElement.update
Creates and wraps this element with another element
Defined in override Ext.dom.AbstractElement_insertion.
Available since: 4.1.0
Parameters
- config : Object (optional)
DomHelper element config object for the wrapper element or null for an empty div
- returnDom : Boolean (optional)
True to return the raw DOM element instead of Ext.dom.AbstractElement
Defaults to:
false - selector : String (optional)
A DomQuery selector to select a descendant node within the created element to use as the wrapping element.
Returns
- HTMLElement/Ext.dom.AbstractElement
The newly created wrapper element
Static Methods addMember( name, member )chainableprivatestatic addMembers( members )chainablestaticAdd methods / properties to the prototype of this class. ...Add methods / properties to the prototype of this class.
Ext.define('My.awesome.Cat', {
constructor: function() {
...
}
});
My.awesome.Cat.addMembers({
meow: function() {
alert('Meowww...');
}
});
var kitty = new My.awesome.Cat;
kitty.meow();
Available since: 4.1.0
Parameters
- members : Object
Add / override static properties of this class. ...Add / override static properties of this class.
Ext.define('My.cool.Class', {
...
});
My.cool.Class.addStatics({
someProperty: 'someValue', // My.cool.Class.someProperty = 'someValue'
method1: function() { ... }, // My.cool.Class.method1 = function() { ... };
method2: function() { ... } // My.cool.Class.method2 = function() { ... };
});
Available since: 4.0.2
Parameters
- members : Object
Returns
- Ext.Base
this
addUnits( size, units )privatestaticTest if size has a unit, otherwise appends the passed unit string, or the default for this Element. ... Borrow another class' members to the prototype of this class. ...Borrow another class' members to the prototype of this class.
Ext.define('Bank', {
money: '$$$',
printMoney: function() {
alert('$$$$$$$');
}
});
Ext.define('Thief', {
...
});
Thief.borrow(Bank, ['money', 'printMoney']);
var steve = new Thief();
alert(steve.money); // alerts '$$$'
steve.printMoney(); // alerts '$$$$$$$'
Available since: 4.0.2
Parameters
- fromClass : Ext.Base
The class to borrow members from
- members : Array/String
The names of the members to borrow
Returns
- Ext.Base
this
camelReplaceFn( m, a )privatestatic Create a new instance of this Class. ...Create a new instance of this Class.
Ext.define('My.cool.Class', {
...
});
My.cool.Class.create({
someConfig: true
});
All parameters are passed to the constructor of the class.
Available since: 4.0.2
Returns
- Object
the created instance.
createAlias( alias, origin )staticCreate aliases for existing prototype methods. ...Create aliases for existing prototype methods. Example:
Ext.define('My.cool.Class', {
method1: function() { ... },
method2: function() { ... }
});
var test = new My.cool.Class();
My.cool.Class.createAlias({
method3: 'method1',
method4: 'method2'
});
test.method3(); // test.method1()
My.cool.Class.createAlias('method5', 'method3');
test.method5(); // test.method3() -> test.method1()
Available since: 4.0.2
Parameters
- alias : String/Object
The new method name, or an object to set multiple aliases. See
flexSetter
- origin : String/Object
The original method name
Returns the top Element that is located at the passed coordinates
Defined in override Ext.dom.AbstractElement_static. ... Retrieves Ext.dom.Element objects. ...Retrieves Ext.dom.Element objects. Ext.get is alias for Ext.dom.Element.get.
This method does not retrieve Components. This method retrieves Ext.dom.Element
objects which encapsulate DOM elements. To retrieve a Component by its ID, use Ext.ComponentManager.get.
Uses simple caching to consistently return the same object. Automatically fixes if an object was recreated with
the same id via AJAX or DOM.
Available since: 4.1.0
Parameters
- el : String/HTMLElement/Ext.Element
The id of the node, a DOM Node or an existing Element.
Returns
- Ext.dom.Element
The Element object (or null if no matching element was found)
getDocumentHeight( ) : NumberstaticRetrieves the document height
Defined in override Ext.dom.AbstractElement_static. ...Retrieves the document height
Defined in override Ext.dom.AbstractElement_static.
Available since: 4.1.0
Returns
- Number
documentHeight
getDocumentWidth( ) : NumberstaticRetrieves the document width
Defined in override Ext.dom.AbstractElement_static. ...Retrieves the document width
Defined in override Ext.dom.AbstractElement_static.
Available since: 4.1.0
Returns
- Number
documentWidth
Get the current class' name in string format. ...Get the current class' name in string format.
Ext.define('My.cool.Class', {
constructor: function() {
alert(this.self.getName()); // alerts 'My.cool.Class'
}
});
My.cool.Class.getName(); // 'My.cool.Class'
Available since: 4.0.4
Returns
- String
className
getOrientation( ) : StringstaticRetrieves the current orientation of the window. ...Retrieves the current orientation of the window. This is calculated by
determing if the height is greater than the width.
Defined in override Ext.dom.AbstractElement_static.
Available since: 4.1.0
Returns
- String
Orientation of window: 'portrait' or 'landscape'
getViewSize( ) : ObjectstaticRetrieves the viewport size of the window. ...Retrieves the viewport size of the window.
Defined in override Ext.dom.AbstractElement_static.
Available since: 4.1.0
Returns
- Object
object containing width and height properties
getViewportHeight( ) : NumberstaticRetrieves the viewport height of the window. ...Retrieves the viewport height of the window.
Defined in override Ext.dom.AbstractElement_static.
Available since: 4.1.0
Returns
- Number
viewportHeight
getViewportWidth( ) : NumberstaticRetrieves the viewport width of the window. ...Retrieves the viewport width of the window.
Defined in override Ext.dom.AbstractElement_static.
Available since: 4.1.0
Returns
- Number
viewportWidth
implement( )deprecatedstaticAdds members to class. ...Adds members to class.
This method has been deprecated since 4.1
Use addMembers instead.
Available since: 4.0.2
isAncestor( p, c )privatestatic Returns an array of unique class names based upon the input strings, or string arrays. ...Returns an array of unique class names based upon the input strings, or string arrays.
The number of parameters is unlimited.
Example
// Add x-invalid and x-mandatory classes, do not duplicate
myElement.dom.className = Ext.core.Element.mergeClsList(this.initialClasses, 'x-invalid x-mandatory');
Available since: 4.1.0
Parameters
- clsList1 : Mixed
A string of class names, or an array of class names.
- clsList2 : Mixed
A string of class names, or an array of class names.
Returns
- Array
An array of strings representing remaining unique, merged class names. If class names were added to the first list, the changed property will be true.
mixin( name, mixinClass )chainableprivatestatic Normalizes CSS property keys from dash delimited to camel case JavaScript Syntax. ...Normalizes CSS property keys from dash delimited to camel case JavaScript Syntax.
For example:
- border-width -> borderWidth
- padding-top -> paddingTop
Defined in override Ext.dom.AbstractElement_static.
Available since: 4.1.0
Parameters
- prop : String
The property to normalize
Returns
- String
The normalized string
onExtended( fn, scope )chainableprivatestatic Override members of this class. ...Override members of this class. Overridden methods can be invoked via
callParent.
Ext.define('My.Cat', {
constructor: function() {
alert("I'm a cat!");
}
});
My.Cat.override({
constructor: function() {
alert("I'm going to be a cat!");
this.callParent(arguments);
alert("Meeeeoooowwww");
}
});
var kitty = new My.Cat(); // alerts "I'm going to be a cat!"
// alerts "I'm a cat!"
// alerts "Meeeeoooowwww"
As of 4.1, direct use of this method is deprecated. Use Ext.define
instead:
Ext.define('My.CatOverride', {
override: 'My.Cat',
constructor: function() {
alert("I'm going to be a cat!");
this.callParent(arguments);
alert("Meeeeoooowwww");
}
});
The above accomplishes the same result but can be managed by the Ext.Loader
which can properly order the override and its target class and the build process
can determine whether the override is needed based on the required state of the
target class (My.Cat).
This method has been deprecated since 4.1.0
Use Ext.define instead
Available since: 4.0.2
Parameters
- members : Object
The properties to add to this class. This should be
specified as an object literal containing one or more properties.
Returns
- Ext.Base
this class
Parses a number or string representing margin sizes into an object. ...Parses a number or string representing margin sizes into an object. Supports CSS-style margin declarations
(e.g. 10, "10", "10 10", "10 10 10" and "10 10 10 10" are all valid options and would return the same result)
Defined in override Ext.dom.AbstractElement_static.
Available since: 4.1.0
Parameters
Returns
- Object
An object with margin sizes for top, right, bottom and left
Converts a CSS string into an object with a property for each style. ...Converts a CSS string into an object with a property for each style.
The sample code below would return an object with 2 properties, one
for background-color and one for color.
var css = 'background-color: red;color: blue; ';
console.log(Ext.dom.Element.parseStyles(css));
Defined in override Ext.dom.AbstractElement_static.
Available since: 4.1.0
Parameters
- styles : String
A CSS string
Returns
- Object
styles
Returns an array of unique class names deom the first parameter with all class names
from the second parameter removed. ...Returns an array of unique class names deom the first parameter with all class names
from the second parameter removed.
Example
// Remove x-invalid and x-mandatory classes if present.
myElement.dom.className = Ext.core.Element.removeCls(this.initialClasses, 'x-invalid x-mandatory');
Available since: 4.1.0
Parameters
- existingClsList : Mixed
A string of class names, or an array of class names.
- removeClsList : Mixed
A string of class names, or an array of class names to remove from existingClsList.
Returns
- Array
An array of strings representing remaining class names. If class names were removed, the changed property will be true.
Selects elements based on the passed CSS selector to enable Element methods
to be applied to many related elements in...Selects elements based on the passed CSS selector to enable Element methods
to be applied to many related elements in one statement through the returned CompositeElement or
CompositeElementLite object.
Available since: 3.4.0
Parameters
- selector : String/HTMLElement[]
The CSS selector or an array of elements
- unique : Boolean (optional)
true to create a unique Ext.Element for each element (defaults to a shared flyweight object)
- root : HTMLElement/String (optional)
The root element of the query or id of the root
Returns
Parses a number or string representing margin sizes into an object. ...Parses a number or string representing margin sizes into an object. Supports CSS-style margin declarations
(e.g. 10, "10", "10 10", "10 10 10" and "10 10 10 10" are all valid options and would return the same result)
Defined in override Ext.dom.AbstractElement_static.
Available since: 4.1.0
Parameters
Returns
- String
An string with unitized (px if units is not specified) metrics for top, right, bottom and left
Add methods / properties to the prototype of this class.
Ext.define('My.awesome.Cat', {
constructor: function() {
...
}
});
My.awesome.Cat.addMembers({
meow: function() {
alert('Meowww...');
}
});
var kitty = new My.awesome.Cat;
kitty.meow();
Available since: 4.1.0
Parameters
- members : Object
Add / override static properties of this class.
Ext.define('My.cool.Class', {
...
});
My.cool.Class.addStatics({
someProperty: 'someValue', // My.cool.Class.someProperty = 'someValue'
method1: function() { ... }, // My.cool.Class.method1 = function() { ... };
method2: function() { ... } // My.cool.Class.method2 = function() { ... };
});
Available since: 4.0.2
Parameters
- members : Object
Returns
- Ext.Base
this
Borrow another class' members to the prototype of this class.
Ext.define('Bank', {
money: '$$$',
printMoney: function() {
alert('$$$$$$$');
}
});
Ext.define('Thief', {
...
});
Thief.borrow(Bank, ['money', 'printMoney']);
var steve = new Thief();
alert(steve.money); // alerts '$$$'
steve.printMoney(); // alerts '$$$$$$$'
Available since: 4.0.2
Parameters
- fromClass : Ext.Base
The class to borrow members from
- members : Array/String
The names of the members to borrow
Returns
- Ext.Base
this
Create a new instance of this Class.
Ext.define('My.cool.Class', {
...
});
My.cool.Class.create({
someConfig: true
});
All parameters are passed to the constructor of the class.
Available since: 4.0.2
Returns
- Object
the created instance.
Create aliases for existing prototype methods. Example:
Ext.define('My.cool.Class', {
method1: function() { ... },
method2: function() { ... }
});
var test = new My.cool.Class();
My.cool.Class.createAlias({
method3: 'method1',
method4: 'method2'
});
test.method3(); // test.method1()
My.cool.Class.createAlias('method5', 'method3');
test.method5(); // test.method3() -> test.method1()
Available since: 4.0.2
Parameters
- alias : String/Object
The new method name, or an object to set multiple aliases. See flexSetter
- origin : String/Object
The original method name
Retrieves Ext.dom.Element objects. Ext.get is alias for Ext.dom.Element.get.
This method does not retrieve Components. This method retrieves Ext.dom.Element objects which encapsulate DOM elements. To retrieve a Component by its ID, use Ext.ComponentManager.get.
Uses simple caching to consistently return the same object. Automatically fixes if an object was recreated with the same id via AJAX or DOM.
Available since: 4.1.0
Parameters
- el : String/HTMLElement/Ext.Element
The id of the node, a DOM Node or an existing Element.
Returns
- Ext.dom.Element
The Element object (or null if no matching element was found)
Retrieves the document height
Defined in override Ext.dom.AbstractElement_static.
Available since: 4.1.0
Returns
- Number
documentHeight
Retrieves the document width
Defined in override Ext.dom.AbstractElement_static.
Available since: 4.1.0
Returns
- Number
documentWidth
Get the current class' name in string format.
Ext.define('My.cool.Class', {
constructor: function() {
alert(this.self.getName()); // alerts 'My.cool.Class'
}
});
My.cool.Class.getName(); // 'My.cool.Class'
Available since: 4.0.4
Returns
- String
className
Retrieves the current orientation of the window. This is calculated by determing if the height is greater than the width.
Defined in override Ext.dom.AbstractElement_static.
Available since: 4.1.0
Returns
- String
Orientation of window: 'portrait' or 'landscape'
Retrieves the viewport size of the window.
Defined in override Ext.dom.AbstractElement_static.
Available since: 4.1.0
Returns
- Object
object containing width and height properties
Retrieves the viewport height of the window.
Defined in override Ext.dom.AbstractElement_static.
Available since: 4.1.0
Returns
- Number
viewportHeight
Retrieves the viewport width of the window.
Defined in override Ext.dom.AbstractElement_static.
Available since: 4.1.0
Returns
- Number
viewportWidth
Adds members to class.
This method has been deprecated since 4.1
Use addMembers instead.
Available since: 4.0.2
Returns an array of unique class names based upon the input strings, or string arrays.
The number of parameters is unlimited.
Example
// Add x-invalid and x-mandatory classes, do not duplicate myElement.dom.className = Ext.core.Element.mergeClsList(this.initialClasses, 'x-invalid x-mandatory');
Available since: 4.1.0
Parameters
- clsList1 : Mixed
A string of class names, or an array of class names.
- clsList2 : Mixed
A string of class names, or an array of class names.
Returns
- Array
An array of strings representing remaining unique, merged class names. If class names were added to the first list, the
changedproperty will betrue.
Normalizes CSS property keys from dash delimited to camel case JavaScript Syntax. For example:
- border-width -> borderWidth
- padding-top -> paddingTop
Defined in override Ext.dom.AbstractElement_static.
Available since: 4.1.0
Parameters
- prop : String
The property to normalize
Returns
- String
The normalized string
Override members of this class. Overridden methods can be invoked via callParent.
Ext.define('My.Cat', {
constructor: function() {
alert("I'm a cat!");
}
});
My.Cat.override({
constructor: function() {
alert("I'm going to be a cat!");
this.callParent(arguments);
alert("Meeeeoooowwww");
}
});
var kitty = new My.Cat(); // alerts "I'm going to be a cat!"
// alerts "I'm a cat!"
// alerts "Meeeeoooowwww"
As of 4.1, direct use of this method is deprecated. Use Ext.define instead:
Ext.define('My.CatOverride', {
override: 'My.Cat',
constructor: function() {
alert("I'm going to be a cat!");
this.callParent(arguments);
alert("Meeeeoooowwww");
}
});
The above accomplishes the same result but can be managed by the Ext.Loader which can properly order the override and its target class and the build process can determine whether the override is needed based on the required state of the target class (My.Cat).
This method has been deprecated since 4.1.0
Use Ext.define instead
Available since: 4.0.2
Parameters
- members : Object
The properties to add to this class. This should be specified as an object literal containing one or more properties.
Returns
- Ext.Base
this class
Parses a number or string representing margin sizes into an object. Supports CSS-style margin declarations (e.g. 10, "10", "10 10", "10 10 10" and "10 10 10 10" are all valid options and would return the same result)
Defined in override Ext.dom.AbstractElement_static.
Available since: 4.1.0
Parameters
Returns
- Object
An object with margin sizes for top, right, bottom and left
Converts a CSS string into an object with a property for each style.
The sample code below would return an object with 2 properties, one for background-color and one for color.
var css = 'background-color: red;color: blue; ';
console.log(Ext.dom.Element.parseStyles(css));
Defined in override Ext.dom.AbstractElement_static.
Available since: 4.1.0
Parameters
- styles : String
A CSS string
Returns
- Object
styles
Returns an array of unique class names deom the first parameter with all class names from the second parameter removed.
Example
// Remove x-invalid and x-mandatory classes if present. myElement.dom.className = Ext.core.Element.removeCls(this.initialClasses, 'x-invalid x-mandatory');
Available since: 4.1.0
Parameters
- existingClsList : Mixed
A string of class names, or an array of class names.
- removeClsList : Mixed
A string of class names, or an array of class names to remove from
existingClsList.
Returns
- Array
An array of strings representing remaining class names. If class names were removed, the
changedproperty will betrue.
Selects elements based on the passed CSS selector to enable Element methods to be applied to many related elements in one statement through the returned CompositeElement or CompositeElementLite object.
Available since: 3.4.0
Parameters
- selector : String/HTMLElement[]
The CSS selector or an array of elements
- unique : Boolean (optional)
true to create a unique Ext.Element for each element (defaults to a shared flyweight object)
- root : HTMLElement/String (optional)
The root element of the query or id of the root
Returns
Parses a number or string representing margin sizes into an object. Supports CSS-style margin declarations (e.g. 10, "10", "10 10", "10 10 10" and "10 10 10 10" are all valid options and would return the same result)
Defined in override Ext.dom.AbstractElement_static.
Available since: 4.1.0
Parameters
Returns
- String
An string with unitized (px if units is not specified) metrics for top, right, bottom and left
Events
Where supported. Fires when an element is activated, for instance, through a mouse click or a keypress.
Available since: 2.3.0
Parameters
- e : Ext.EventObject
The Ext.EventObject encapsulating the DOM event.
- t : HTMLElement
The target of the event.
- eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Where supported. Fires when an attribute has been modified.
Available since: 2.3.0
Parameters
- e : Ext.EventObject
The Ext.EventObject encapsulating the DOM event.
- t : HTMLElement
The target of the event.
- eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Where supported. Fires when the character data has been modified.
Available since: 2.3.0
Parameters
- e : Ext.EventObject
The Ext.EventObject encapsulating the DOM event.
- t : HTMLElement
The target of the event.
- eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Where supported. Similar to HTML focus event, but can be applied to any focusable element.
Available since: 2.3.0
Parameters
- e : Ext.EventObject
The Ext.EventObject encapsulating the DOM event.
- t : HTMLElement
The target of the event.
- eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Where supported. Similar to HTML blur event, but can be applied to any focusable element.
Available since: 2.3.0
Parameters
- e : Ext.EventObject
The Ext.EventObject encapsulating the DOM event.
- t : HTMLElement
The target of the event.
- eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Where supported. Fires when a node has been added as a child of another node.
Available since: 2.3.0
Parameters
- e : Ext.EventObject
The Ext.EventObject encapsulating the DOM event.
- t : HTMLElement
The target of the event.
- eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Where supported. Fires when a node is being inserted into a document.
Available since: 2.3.0
Parameters
- e : Ext.EventObject
The Ext.EventObject encapsulating the DOM event.
- t : HTMLElement
The target of the event.
- eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Where supported. Fires when a descendant node of the element is removed.
Available since: 2.3.0
Parameters
- e : Ext.EventObject
The Ext.EventObject encapsulating the DOM event.
- t : HTMLElement
The target of the event.
- eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Where supported. Fires when a node is being removed from a document.
Available since: 2.3.0
Parameters
- e : Ext.EventObject
The Ext.EventObject encapsulating the DOM event.
- t : HTMLElement
The target of the event.
- eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Where supported. Fires when the subtree is modified.
Available since: 2.3.0
Parameters
- e : Ext.EventObject
The Ext.EventObject encapsulating the DOM event.
- t : HTMLElement
The target of the event.
- eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires when an object/image is stopped from loading before completely loaded.
Available since: 2.3.0
Parameters
- e : Ext.EventObject
The Ext.EventObject encapsulating the DOM event.
- t : HTMLElement
The target of the event.
- eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires when an element loses focus either via the pointing device or by tabbing navigation.
Available since: 2.3.0
Parameters
- e : Ext.EventObject
The Ext.EventObject encapsulating the DOM event.
- t : HTMLElement
The target of the event.
- eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires when a control loses the input focus and its value has been modified since gaining focus.
Available since: 2.3.0
Parameters
- e : Ext.EventObject
The Ext.EventObject encapsulating the DOM event.
- t : HTMLElement
The target of the event.
- eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires when a mouse click is detected within the element.
Available since: 2.3.0
Parameters
- e : Ext.EventObject
The Ext.EventObject encapsulating the DOM event.
- t : HTMLElement
The target of the event.
- eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires when a mouse double click is detected within the element.
Available since: 2.3.0
Parameters
- e : Ext.EventObject
The Ext.EventObject encapsulating the DOM event.
- t : HTMLElement
The target of the event.
- eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires when an object/image/frame cannot be loaded properly.
Available since: 2.3.0
Parameters
- e : Ext.EventObject
The Ext.EventObject encapsulating the DOM event.
- t : HTMLElement
The target of the event.
- eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires when an element receives focus either via the pointing device or by tab navigation.
Available since: 2.3.0
Parameters
- e : Ext.EventObject
The Ext.EventObject encapsulating the DOM event.
- t : HTMLElement
The target of the event.
- eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires when a keydown is detected within the element.
Available since: 2.3.0
Parameters
- e : Ext.EventObject
The Ext.EventObject encapsulating the DOM event.
- t : HTMLElement
The target of the event.
- eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires when a keypress is detected within the element.
Available since: 2.3.0
Parameters
- e : Ext.EventObject
The Ext.EventObject encapsulating the DOM event.
- t : HTMLElement
The target of the event.
- eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires when a keyup is detected within the element.
Available since: 2.3.0
Parameters
- e : Ext.EventObject
The Ext.EventObject encapsulating the DOM event.
- t : HTMLElement
The target of the event.
- eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires when the user agent finishes loading all content within the element. Only supported by window, frames, objects and images.
Available since: 2.3.0
Parameters
- e : Ext.EventObject
The Ext.EventObject encapsulating the DOM event.
- t : HTMLElement
The target of the event.
- eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires when a mousedown is detected within the element.
Available since: 2.3.0
Parameters
- e : Ext.EventObject
The Ext.EventObject encapsulating the DOM event.
- t : HTMLElement
The target of the event.
- eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires when the mouse enters the element.
Available since: 3.4.0
Parameters
- e : Ext.EventObject
The Ext.EventObject encapsulating the DOM event.
- t : HTMLElement
The target of the event.
- eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires when the mouse leaves the element.
Available since: 3.4.0
Parameters
- e : Ext.EventObject
The Ext.EventObject encapsulating the DOM event.
- t : HTMLElement
The target of the event.
- eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires when a mousemove is detected with the element.
Available since: 2.3.0
Parameters
- e : Ext.EventObject
The Ext.EventObject encapsulating the DOM event.
- t : HTMLElement
The target of the event.
- eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires when a mouseout is detected with the element.
Available since: 2.3.0
Parameters
- e : Ext.EventObject
The Ext.EventObject encapsulating the DOM event.
- t : HTMLElement
The target of the event.
- eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires when a mouseover is detected within the element.
Available since: 2.3.0
Parameters
- e : Ext.EventObject
The Ext.EventObject encapsulating the DOM event.
- t : HTMLElement
The target of the event.
- eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires when a mouseup is detected within the element.
Available since: 2.3.0
Parameters
- e : Ext.EventObject
The Ext.EventObject encapsulating the DOM event.
- t : HTMLElement
The target of the event.
- eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires when a form is reset.
Available since: 2.3.0
Parameters
- e : Ext.EventObject
The Ext.EventObject encapsulating the DOM event.
- t : HTMLElement
The target of the event.
- eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires when a document view is resized.
Available since: 2.3.0
Parameters
- e : Ext.EventObject
The Ext.EventObject encapsulating the DOM event.
- t : HTMLElement
The target of the event.
- eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires when a document view is scrolled.
Available since: 2.3.0
Parameters
- e : Ext.EventObject
The Ext.EventObject encapsulating the DOM event.
- t : HTMLElement
The target of the event.
- eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires when a user selects some text in a text field, including input and textarea.
Available since: 2.3.0
Parameters
- e : Ext.EventObject
The Ext.EventObject encapsulating the DOM event.
- t : HTMLElement
The target of the event.
- eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires when a form is submitted.
Available since: 2.3.0
Parameters
- e : Ext.EventObject
The Ext.EventObject encapsulating the DOM event.
- t : HTMLElement
The target of the event.
- eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires when the user agent removes all content from a window or frame. For elements, it fires when the target element or any of its content has been removed.
Available since: 2.3.0
Parameters
- e : Ext.EventObject
The Ext.EventObject encapsulating the DOM event.
- t : HTMLElement
The target of the event.
- eOpts : Object
The options object passed to Ext.util.Observable.addListener.