ExtReact Docs Help

Introduction

The documentation for the ExtReact product diverges somewhat from the documentation of other Sencha products. The sections below describe documentation for all products except where indicated as unique to ExtReact.

Terms, Icons, and Labels

Many classes have shortcut names used when creating (instantiating) a class with a configuration object. The shortcut name is referred to as an alias (or xtype if the class extends Ext.Component). The alias/xtype is listed next to the class name of applicable classes for quick reference.

ExtReact component classes list the configurable name prominently at the top of the API class doc followed by the fully-qualified class name.

Access Levels

Framework classes or their members may be specified as private or protected. Else, the class / member is public. Public, protected, and private are access descriptors used to convey how and when the class or class member should be used.

Member Types

Member Syntax

Below is an example class member that we can disect to show the syntax of a class member (the lookupComponent method as viewed from the Ext.button.Button class in this case).

lookupComponent ( item ) : Ext.Component
protected

Called when a raw config object is added to this container either during initialization of the items config, or when new items are added), or {@link #insert inserted.

This method converts the passed object into an instanced child component.

This may be overridden in subclasses when special processing needs to be applied to child creation.

Parameters

item :  Object

The config object being added.

Returns
Ext.Component

The component to be added.

Let's look at each part of the member row:

Member Flags

The API documentation uses a number of flags to further commnicate the class member's function and intent. The label may be represented by a text label, an abbreviation, or an icon.

Class Icons

- Indicates a framework class

- A singleton framework class. *See the singleton flag for more information

- A component-type framework class (any class within the Ext JS framework that extends Ext.Component)

- Indicates that the class, member, or guide is new in the currently viewed version

Member Icons

- Indicates a class member of type config

Or in the case of an ExtReact component class this indicates a member of type prop

- Indicates a class member of type property

- Indicates a class member of type method

- Indicates a class member of type event

- Indicates a class member of type theme variable

- Indicates a class member of type theme mixin

- Indicates that the class, member, or guide is new in the currently viewed version

Class Member Quick-Nav Menu

Just below the class name on an API doc page is a row of buttons corresponding to the types of members owned by the current class. Each button shows a count of members by type (this count is updated as filters are applied). Clicking the button will navigate you to that member section. Hovering over the member-type button will reveal a popup menu of all members of that type for quick navigation.

Getter and Setter Methods

Getting and setter methods that correlate to a class config option will show up in the methods section as well as in the configs section of both the API doc and the member-type menus just beneath the config they work with. The getter and setter method documentation will be found in the config row for easy reference.

ExtReact component classes do not hoist the getter / setter methods into the prop. All methods will be described in the Methods section

History Bar

Your page history is kept in localstorage and displayed (using the available real estate) just below the top title bar. By default, the only search results shown are the pages matching the product / version you're currently viewing. You can expand what is displayed by clicking on the button on the right-hand side of the history bar and choosing the "All" radio option. This will show all recent pages in the history bar for all products / versions.

Within the history config menu you will also see a listing of your recent page visits. The results are filtered by the "Current Product / Version" and "All" radio options. Clicking on the button will clear the history bar as well as the history kept in local storage.

If "All" is selected in the history config menu the checkbox option for "Show product details in the history bar" will be enabled. When checked, the product/version for each historic page will show alongside the page name in the history bar. Hovering the cursor over the page names in the history bar will also show the product/version as a tooltip.

Search and Filters

Both API docs and guides can be searched for using the search field at the top of the page.

On API doc pages there is also a filter input field that filters the member rows using the filter string. In addition to filtering by string you can filter the class members by access level, inheritance, and read only. This is done using the checkboxes at the top of the page.

The checkbox at the bottom of the API class navigation tree filters the class list to include or exclude private classes.

Clicking on an empty search field will show your last 10 searches for quick navigation.

API Doc Class Metadata

Each API doc page (with the exception of Javascript primitives pages) has a menu view of metadata relating to that class. This metadata view will have one or more of the following:

Expanding and Collapsing Examples and Class Members

Runnable examples (Fiddles) are expanded on a page by default. You can collapse and expand example code blocks individually using the arrow on the top-left of the code block. You can also toggle the collapse state of all examples using the toggle button on the top-right of the page. The toggle-all state will be remembered between page loads.

Class members are collapsed on a page by default. You can expand and collapse members using the arrow icon on the left of the member row or globally using the expand / collapse all toggle button top-right.

Desktop -vs- Mobile View

Viewing the docs on narrower screens or browsers will result in a view optimized for a smaller form factor. The primary differences between the desktop and "mobile" view are:

Viewing the Class Source

The class source can be viewed by clicking on the class name at the top of an API doc page. The source for class members can be viewed by clicking on the "view source" link on the right-hand side of the member row.

ExtReact 6.6.0


top

NPM Package

@sencha/ext-react

Hierarchy

Ext.dom.CompositeElementLite

Summary

This class encapsulates a collection of DOM elements, providing methods to filter members, or to perform collective actions upon the whole set.

Although they are not listed, this class supports all of the methods of Ext.dom.Element. The methods from these classes will be performed on all the elements in this collection.

Example:

var els = Ext.select("#some-el div.some-class");
// or select directly from an existing element
var el = Ext.get('some-el');
el.select('div.some-class');

els.setWidth(100); // all elements become 100 width
els.hide(true); // all elements fade out and hide
// or
els.setWidth(100).hide(true);
No members found using the current filters

properties

Instance Properties

component : Ext.Component

A reference to the Component that owns this element. This is null if there is no direct owner.

isComposite : Boolean

true in this class to identify an object as an instantiated CompositeElement, or subclass thereof.

Defaults to:

true

isObservable : Boolean

true in this class to identify an object as an instantiated Observable, or subclass thereof.

Defaults to:

true

Static Properties

CLIP : Number
static sta

Visibility mode constant for use with Ext.dom.Element#setVisibilityMode. Use CSS clip property to reduce element's dimensions to 0px by 0px, effectively making it hidden while not being truly invisible. This is useful when an element needs to be published to the Assistive Technologies such as screen readers.

Defaults to:

4

DISPLAY : Number
static sta

Visibility mode constant for use with Ext.dom.Element#setVisibilityMode. Use the CSS 'display' property to hide the element.

Defaults to:

2

OFFSETS : Number
static sta

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

OPACITY : Number
static sta

Visibility mode constant for use with Ext.dom.Element#setVisibilityMode. Use CSS opacity property to set an elements opacity to 0

Defaults to:

5

VISIBILITY : Number
static sta

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

methods

Instance Methods

addListener ( eventName, [fn], [scope], [options], [order] ) : Object

The on method is shorthand for addListener.

Appends an event handler to this object. For example:

myGridPanel.on("itemclick", this.onItemClick, this);

The method also allows for a single argument to be passed which is a config object containing properties which specify multiple events. For example:

myGridPanel.on({
    cellclick: this.onCellClick,
    select: this.onSelect,
    viewready: this.onViewReady,
    scope: this // Important. Ensure "this" is correct during handler execution
});

One can also specify options for each event handler separately:

myGridPanel.on({
    cellclick: {fn: this.onCellClick, scope: this, single: true},
    viewready: {fn: panel.onViewReady, scope: panel}
});

Names of methods in a specified scope may also be used:

myGridPanel.on({
    cellclick: {fn: 'onCellClick', scope: this, single: true},
    viewready: {fn: 'onViewReady', scope: panel}
});

Parameters

eventName :  String/Object

The name of the event to listen for. May also be an object who's property names are event names.

fn :  Function/String (optional)

The method the event invokes or the name of the method within the specified scope. Will be called with arguments given to Ext.util.Observable#fireEvent plus the options parameter described below.

scope :  Object (optional)

The scope (this reference) in which the handler function is executed. If omitted, defaults to the object which fired the event.

options :  Object (optional)

An object containing handler configuration.

Note: The options object will also be passed as the last argument to every event handler.

This object may contain any of the following properties:

scope :  Object

The scope (this reference) in which the handler function is executed. If omitted, defaults to the object which fired the event.

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.

onFrame :  Number

Causes the handler to be scheduled to run at the next animation frame event. If the event fires again before that time, the handler is not rescheduled - the handler will only be called once when the next animation frame is fired, with the last set of arguments passed.

target :  Ext.util.Observable

Only call the handler if the event was fired on the target Observable, not if the event was bubbled up from a child Observable.

element :  String

This option is only valid for listeners bound to Ext.Component. The name of a Component property which references an Ext.dom.Element to add a listener to.

This option is useful during Component construction to add DOM event listeners to elements of Ext.Component which will exist only after the Component is rendered.

For example, to add a click listener to a Panel's body:

  var panel = new Ext.panel.Panel({
      title: 'The title',
      listeners: {
          click: this.handlePanelClick,
          element: 'body'
      }
  });

In order to remove listeners attached using the element, you'll need to reference the element itself as seen below.

 panel.body.un(...)

delegate :  String (optional)

A simple selector to filter the event target or look for a descendant of the target.

The "delegate" option is only available on Ext.dom.Element instances (or when attaching a listener to a Ext.dom.Element via a Component using the element option).

See the delegate example below.

capture :  Boolean (optional)

When set to true, the listener is fired in the capture phase of the event propagation sequence, instead of the default bubble phase.

The capture option is only available on Ext.dom.Element instances (or when attaching a listener to a Ext.dom.Element via a Component using the element option).

stopPropagation :  Boolean (optional)

This option is only valid for listeners bound to Ext.dom.Element. true to call stopPropagation on the event object before firing the handler.

preventDefault :  Boolean (optional)

This option is only valid for listeners bound to Ext.dom.Element. true to call preventDefault on the event object before firing the handler.

stopEvent :  Boolean (optional)

This option is only valid for listeners bound to Ext.dom.Element. true to call stopEvent on the event object before firing the handler.

args :  Array (optional)

Optional arguments to pass to the handler function. Any additional arguments passed to fireEvent will be appended to these arguments.

destroyable :  Boolean (optional)

When specified as true, the function returns a destroyable object. An object which implements the destroy method which removes all listeners added in this call. This syntax can be a helpful shortcut to using un; particularly when removing multiple listeners. NOTE - not compatible when using the element option. See un for the proper syntax for removing listeners added using the element config.

Defaults to:

false

priority :  Number (optional)

An optional numeric priority that determines the order in which event handlers are run. Event handlers with no priority will be run as if they had a priority of 0. Handlers with a higher priority will be prioritized to run sooner than those with a lower priority. Negative numbers can be used to set a priority lower than the default. Internally, the framework uses a range of 1000 or greater, and -1000 or lesser for handlers that are intended to run before or after all others, so it is recommended to stay within the range of -999 to 999 when setting the priority of event handlers in application-level code. A priority must be an integer to be valid. Fractional values are reserved for internal framework use.

order :  String (optional)

A legacy option that is provided for backward compatibility. It is recommended to use the priority option instead. Available options are:

  • 'before': equal to a priority of 100
  • 'current': equal to a priority of 0 or default priority
  • 'after': equal to a priority of -100

Defaults to:

'current'

order :  String (optional)

A shortcut for the order event option. Provided for backward compatibility. Please use the priority event option instead.

Combining Options

Using the options argument, it is possible to combine different types of listeners:

A delayed, one-time listener.

myPanel.on('hide', this.handleClick, this, {
    single: true,
    delay: 100
});

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 and handler configs.

grid.on({
    itemclick: 'onItemClick',
    itemcontextmenu: grid.onItemContextmenu,
    destroy: {
        fn: function () {
            // function called within the 'altCmp' scope instead of grid
        },
        scope: altCmp // unique scope for the destroy handler
    },
    scope: grid       // default scope - provided for example clarity
});

Delegate

This is a configuration option that you can pass along when registering a handler for an event to assist with event delegation. 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:

var panel = Ext.create({
    xtype: 'panel',
    renderTo: document.body,
    title: 'Delegate Handler Example',
    frame: true,
    height: 220,
    width: 220,
    html: '<h1 class="myTitle">BODY TITLE</h1>Body content'
});

// The click handler will only be called when the click occurs on the
// delegate: h1.myTitle ("h1" tag with class "myTitle")
panel.on({
    click: function (e) {
        console.log(e.getTarget().innerHTML);
    },
    element: 'body',
    delegate: 'h1.myTitle'
 });

Defaults to: 'current'

Returns

:Object

Only when the destroyable option is specified.

A Destroyable object. An object which implements the destroy method which removes all listeners added in this call. For example:

this.btnListeners =  = myButton.on({
    destroyable: true
    mouseover:   function() { console.log('mouseover'); },
    mouseout:    function() { console.log('mouseout'); },
    click:       function() { console.log('click'); }
});

And when those listeners need to be removed:

Ext.destroy(this.btnListeners);

or

this.btnListeners.destroy();

addManagedListener ( item, ename, [fn], [scope], [options] ) : Object

The addManagedListener method is used when some object (call it "A") is listening to an event on another observable object ("B") and you want to remove that listener from "B" when "A" is destroyed. This is not an issue when "B" is destroyed because all of its listeners will be removed at that time.

Example:

Ext.define('Foo', {
    extend: 'Ext.Component',

    initComponent: function () {
        this.addManagedListener(MyApp.SomeGlobalSharedMenu, 'show', this.doSomething);
        this.callParent();
    }
});

As you can see, when an instance of Foo is destroyed, it ensures that the 'show' listener on the menu (MyApp.SomeGlobalSharedMenu) is also removed.

As of version 5.1 it is no longer necessary to use this method in most cases because listeners are automatically managed if the scope object provided to addListener is an Observable instance. However, if the observable instance and scope are not the same object you still need to use mon or addManagedListener if you want the listener to be managed.

Parameters

item :  Ext.util.Observable/Ext.dom.Element

The item to which to add a listener/listeners.

ename :  Object/String

The event name, or an object containing event name properties.

fn :  Function/String (optional)

If the ename parameter was an event name, this is the handler function or the name of a method on the specified scope.

scope :  Object (optional)

If the ename parameter was an event name, this is the scope (this reference) in which the handler function is executed.

options :  Object (optional)

If the ename parameter was an event name, this is the addListener options.

Returns

:Object

Only when the destroyable option is specified.

A Destroyable object. An object which implements the destroy method which removes all listeners added in this call. For example:

this.btnListeners = myButton.mon({
    destroyable: true
     mouseover:   function() { console.log('mouseover'); },
    mouseout:    function() { console.log('mouseout'); },
    click:       function() { console.log('click'); }
});

And when those listeners need to be removed:

Ext.destroy(this.btnListeners);

or

this.btnListeners.destroy();

alignTo ( element, [position], [offsets] ) : Ext.util.Positionable

Aligns the 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").
  • 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.
  • Two edge/offset descriptors: An edge/offset descriptor is an edge initial (t/r/b/l) followed by a percentage along that side. This describes a point to align with a similar point in the target. So 't0-b0' would be the same as 'tl-bl', 'l0-r50' would place the top left corner of this item halfway down the right edge of the target item. This allows more flexibility and also describes which two edges are considered adjacent when positioning a tip pointer.

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
 t      The center of the top edge
 tr     The top right corner
 l      The center of the left edge
 c      The center
 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", "tl-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]);

// align the 25% point on the bottom edge of this el
// with the 75% point on the top edge of other-el.
el.alignTo("other-el", 'b25-c75');

Parameters

element :  Ext.util.Positionable/HTMLElement/String

The Positionable, HTMLElement, or id of 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] Element animation config object

Returns

:Ext.util.Positionable

this

clearListeners

Removes all listeners for this object including the managed listeners

clearManagedListeners

Removes all managed listeners for this object.

down ( selector, [returnDom] ) : HTMLElement/Ext.dom.Element

Selects a single child at any depth below this element based on the passed CSS selector (the selector should not contain an id).

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 is true)

enableBubble ( eventNames )

Enables events fired by this Observable to bubble up an owner hierarchy by calling this.getBubbleTarget() if present. There is no implementation in the Observable base class.

This is commonly used by Ext.Components to bubble events to owner Containers. See Ext.Component#getBubbleTarget. The default implementation in Ext.Component returns the Component's immediate owner. But if a known target is required, this can be overridden to access the required target more quickly.

Example:

Ext.define('Ext.overrides.form.field.Base', {
    override: 'Ext.form.field.Base',

    //  Add functionality to Field's initComponent to enable the change event to bubble
    initComponent: function () {
        this.callParent();
        this.enableBubble('change');
    }
});

var myForm = Ext.create('Ext.form.Panel', {
    title: 'User Details',
    items: [{
        ...
    }],
    listeners: {
        change: function() {
            // Title goes red if form has been modified.
            myForm.header.setStyle('color', 'red');
        }
    }
});

Parameters

eventNames :  String/String[]

The event name to bubble, or an Array of event names.

fireEvent ( eventName, args ) : Boolean

Fires the specified event with the passed parameters (minus the event name, plus the options object passed to addListener).

An event may be set to bubble up an Observable parent hierarchy (See Ext.Component#getBubbleTarget) by calling enableBubble.

Parameters

eventName :  String

The name of the event to fire.

args :  Object...

Variable number of parameters are passed to handlers.

Returns

:Boolean

returns false if any of the handlers return false otherwise it returns true.

fireEventArgs ( eventName, args ) : Boolean

Fires the specified event with the passed parameter list.

An event may be set to bubble up an Observable parent hierarchy (See Ext.Component#getBubbleTarget) by calling enableBubble.

Parameters

eventName :  String

The name of the event to fire.

args :  Object[]

An array of parameters which are passed to handlers.

Returns

:Boolean

returns false if any of the handlers return false otherwise it returns true.

fireEventedAction ( eventName, args, fn, [scope], [fnArgs] )

Fires the specified event with the passed parameters and executes a function (action). Evented Actions will automatically dispatch a 'before' event passing. This event will be given a special controller that allows for pausing/resuming of the event flow.

By pausing the controller the updater and events will not run until resumed. Pausing, however, will not stop the processing of any other before events.

Parameters

eventName :  String

The name of the event to fire.

args :  Array

Arguments to pass to handlers and to the action function.

fn :  Function/String

The action function.

scope :  Object (optional)

The scope (this reference) in which the handler function is executed. If omitted, defaults to the object which fired the event.

fnArgs :  Array/Boolean (optional)

Optional arguments for the action fn. If not given, the normal args will be used to call fn. If false is passed, the args are used but if the first argument is this instance it will be removed from the args passed to the action function.

focus ( [defer] ) : Ext.dom.Element

Try to focus the element either immediately or after a timeout if defer argument is specified.

Parameters

defer :  Number (optional)

Milliseconds to defer the focus

Returns

:Ext.dom.Element

this

getAlignToXY ( alignToEl, [position], [offsets] ) : Number[]

Gets the x,y coordinates to align this element with another element. See alignTo for more info on the supported position values.

Parameters

alignToEl :  Ext.util.Positionable/HTMLElement/String

The Positionable, HTMLElement, or id of 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]

Returns

:Number[]

[x, y]

getAnchorXY ( [anchor], [local], [size] ) : Number[]

Gets the x,y coordinates specified by the anchor position on the element.

Parameters

anchor :  String (optional)

The specified anchor position. See alignTo for details on supported anchor positions.

Defaults to: 'tl'

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

getBox ( [contentBox], [local] ) : Object

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.

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 relative to its offsetParent are returned instead of page x/y.

Returns

:Object

An object in the format

x :  Number

The element's X position.

y :  Number

The element's Y position.

width :  Number

The element's width.

height :  Number

The element's height.

bottom :  Number

The element's lower bound.

right :  Number

The 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. The result may also be used for setXY

getClientRegion Ext.util.Region

Returns a region object that defines the client area of this element.

That is, the area within any scrollbars.

Returns

:Ext.util.Region

A Region containing "top, left, bottom, right" properties.

getConstrainRegion Ext.util.Region

Returns the content region of this element for purposes of constraining or clipping floating children. That is the region within the borders and scrollbars, but not within the padding.

Returns

:Ext.util.Region

A Region containing "top, left, bottom, right" properties.

getConstrainVector ( [constrainTo], [proposedPosition], [proposedSize] ) : Number[]/Boolean

Returns the [X, Y] vector by which this Positionable's element must be translated to make a best attempt to constrain within the passed constraint. Returns false if the 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 the element is to be constrained, or a Ext.util.Region into which this element is to be constrained.

By default, any extra shadow around the element is not included in the constrain calculations - the edges of the element are used as the element bounds. To constrain the shadow within the constrain region, set the constrainShadow property on this element to true.

Parameters

constrainTo :  Ext.util.Positionable/HTMLElement/String/Ext.util.Region (optional)

The Positionable, HTMLElement, element id, or Region into which the element is to be constrained.

proposedPosition :  Number[] (optional)

A proposed [X, Y] position to test for validity and to produce a vector for instead of using the element's current position

proposedSize :  Number[] (optional)

A proposed [width, height] size to constrain instead of using the element's current size

Returns

:Number[]/Boolean

If the element needs to be translated, an [X, Y] vector by which this element must be translated. Otherwise, false.

getLocalX Number

Returns the x coordinate of this element reletive to its offsetParent.

Returns

:Number

The local x coordinate

getLocalXY Number[]

Returns the x and y coordinates of this element relative to its offsetParent.

Returns

:Number[]

The local XY position of the element

getLocalY Number

Returns the y coordinate of this element reletive to its offsetParent.

Returns

:Number

The local y coordinate

getOffsetsTo ( offsetsTo ) : Number[]

Returns the offsets of this element from the passed element. The element must both be part of the DOM tree and not have display:none to have page coordinates.

Parameters

offsetsTo :  Ext.util.Positionable/HTMLElement/String

The Positionable, HTMLElement, or element id to get get the offsets from.

Returns

:Number[]

The XY page offsets (e.g. [100, -200])

getRegion ( [contentBox], [local] ) : Ext.util.Region

Returns a region object that defines the area of this element.

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 relative to its offsetParent are returned instead of page x/y.

Returns

:Ext.util.Region

A Region containing "top, left, bottom, right" properties.

getTextWidth ( text, [min], [max] ) : Number

Returns the width in pixels of the passed text, or the width of the text in this Element.

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.

getValue ( asNumber ) : String/Number

Returns the value of the value attribute.

Parameters

asNumber :  Boolean

true to parse the value as a number.

Returns

:String/Number

getViewRegion Ext.util.Region

Returns the content region of this element. That is the region within the borders and padding.

Returns

:Ext.util.Region

A Region containing "top, left, bottom, right" member data.

getX Number

Gets the current X position of the DOM element based on page coordinates.

Returns

:Number

The X position of the element

getXY Number[]

Gets the current position of the DOM element based on page coordinates.

Returns

:Number[]

The XY position of the element

getY Number

Gets the current Y position of the DOM element based on page coordinates.

Returns

:Number

The Y position of the element

hasListener ( eventName ) : Boolean

Checks to see if this object has any listeners for a specified event, or whether the event bubbles. The answer indicates whether the event needs firing or not.

Parameters

eventName :  String

The name of the event to check for

Returns

:Boolean

true if the event is being listened for or bubbles, else false

is ( selector ) : Boolean

Returns true if this element matches the passed simple selector (e.g. 'div.some-class' or 'span:first-child').

Parameters

selector :  String/Function

The simple selector to test or a function which is passed candidate nodes, and should return true for nodes which match.

Returns

:Boolean

true if this element matches the selector, else false.

isFocusable Boolean

Checks whether this element can be focused programmatically or by clicking. To check if an element is in the document tab flow, use isTabbable.

Returns

:Boolean

True if the element is focusable

isSuspended ( [event] ) : Boolean

Checks if all events, or a specific event, is suspended.

Parameters

event :  String (optional)

The name of the specific event to check

Returns

:Boolean

true if events are suspended

mon ( item, ename, [fn], [scope], [options] ) : Object

Shorthand for addManagedListener. The addManagedListener method is used when some object (call it "A") is listening to an event on another observable object ("B") and you want to remove that listener from "B" when "A" is destroyed. This is not an issue when "B" is destroyed because all of its listeners will be removed at that time.

Example:

Ext.define('Foo', {
    extend: 'Ext.Component',

    initComponent: function () {
        this.addManagedListener(MyApp.SomeGlobalSharedMenu, 'show', this.doSomething);
        this.callParent();
    }
});

As you can see, when an instance of Foo is destroyed, it ensures that the 'show' listener on the menu (MyApp.SomeGlobalSharedMenu) is also removed.

As of version 5.1 it is no longer necessary to use this method in most cases because listeners are automatically managed if the scope object provided to addListener is an Observable instance. However, if the observable instance and scope are not the same object you still need to use mon or addManagedListener if you want the listener to be managed.

Parameters

item :  Ext.util.Observable/Ext.dom.Element

The item to which to add a listener/listeners.

ename :  Object/String

The event name, or an object containing event name properties.

fn :  Function/String (optional)

If the ename parameter was an event name, this is the handler function or the name of a method on the specified scope.

scope :  Object (optional)

If the ename parameter was an event name, this is the scope (this reference) in which the handler function is executed.

options :  Object (optional)

If the ename parameter was an event name, this is the addListener options.

Returns

:Object

Only when the destroyable option is specified.

A Destroyable object. An object which implements the destroy method which removes all listeners added in this call. For example:

this.btnListeners = myButton.mon({
    destroyable: true
     mouseover:   function() { console.log('mouseover'); },
    mouseout:    function() { console.log('mouseout'); },
    click:       function() { console.log('click'); }
});

And when those listeners need to be removed:

Ext.destroy(this.btnListeners);

or

this.btnListeners.destroy();

move ( direction, distance )

Move the element relative to its current position.

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 move the element in pixels

mun ( item, ename, [fn], [scope] )

Shorthand for removeManagedListener. Removes listeners that were added by the mon method.

Parameters

item :  Ext.util.Observable/Ext.dom.Element

The item from which to remove a listener/listeners.

ename :  Object/String

The event name, or an object containing event name properties.

fn :  Function (optional)

If the ename parameter was an event name, this is the handler function.

scope :  Object (optional)

If the ename parameter was an event name, this is the scope (this reference) in which the handler function is executed.

on ( eventName, [fn], [scope], [options], [order] ) : Object

The on method is shorthand for addListener.

Appends an event handler to this object. For example:

myGridPanel.on("itemclick", this.onItemClick, this);

The method also allows for a single argument to be passed which is a config object containing properties which specify multiple events. For example:

myGridPanel.on({
    cellclick: this.onCellClick,
    select: this.onSelect,
    viewready: this.onViewReady,
    scope: this // Important. Ensure "this" is correct during handler execution
});

One can also specify options for each event handler separately:

myGridPanel.on({
    cellclick: {fn: this.onCellClick, scope: this, single: true},
    viewready: {fn: panel.onViewReady, scope: panel}
});

Names of methods in a specified scope may also be used:

myGridPanel.on({
    cellclick: {fn: 'onCellClick', scope: this, single: true},
    viewready: {fn: 'onViewReady', scope: panel}
});

Parameters

eventName :  String/Object

The name of the event to listen for. May also be an object who's property names are event names.

fn :  Function/String (optional)

The method the event invokes or the name of the method within the specified scope. Will be called with arguments given to Ext.util.Observable#fireEvent plus the options parameter described below.

scope :  Object (optional)

The scope (this reference) in which the handler function is executed. If omitted, defaults to the object which fired the event.

options :  Object (optional)

An object containing handler configuration.

Note: The options object will also be passed as the last argument to every event handler.

This object may contain any of the following properties:

scope :  Object

The scope (this reference) in which the handler function is executed. If omitted, defaults to the object which fired the event.

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.

onFrame :  Number

Causes the handler to be scheduled to run at the next animation frame event. If the event fires again before that time, the handler is not rescheduled - the handler will only be called once when the next animation frame is fired, with the last set of arguments passed.

target :  Ext.util.Observable

Only call the handler if the event was fired on the target Observable, not if the event was bubbled up from a child Observable.

element :  String

This option is only valid for listeners bound to Ext.Component. The name of a Component property which references an Ext.dom.Element to add a listener to.

This option is useful during Component construction to add DOM event listeners to elements of Ext.Component which will exist only after the Component is rendered.

For example, to add a click listener to a Panel's body:

  var panel = new Ext.panel.Panel({
      title: 'The title',
      listeners: {
          click: this.handlePanelClick,
          element: 'body'
      }
  });

In order to remove listeners attached using the element, you'll need to reference the element itself as seen below.

 panel.body.un(...)

delegate :  String (optional)

A simple selector to filter the event target or look for a descendant of the target.

The "delegate" option is only available on Ext.dom.Element instances (or when attaching a listener to a Ext.dom.Element via a Component using the element option).

See the delegate example below.

capture :  Boolean (optional)

When set to true, the listener is fired in the capture phase of the event propagation sequence, instead of the default bubble phase.

The capture option is only available on Ext.dom.Element instances (or when attaching a listener to a Ext.dom.Element via a Component using the element option).

stopPropagation :  Boolean (optional)

This option is only valid for listeners bound to Ext.dom.Element. true to call stopPropagation on the event object before firing the handler.

preventDefault :  Boolean (optional)

This option is only valid for listeners bound to Ext.dom.Element. true to call preventDefault on the event object before firing the handler.

stopEvent :  Boolean (optional)

This option is only valid for listeners bound to Ext.dom.Element. true to call stopEvent on the event object before firing the handler.

args :  Array (optional)

Optional arguments to pass to the handler function. Any additional arguments passed to fireEvent will be appended to these arguments.

destroyable :  Boolean (optional)

When specified as true, the function returns a destroyable object. An object which implements the destroy method which removes all listeners added in this call. This syntax can be a helpful shortcut to using un; particularly when removing multiple listeners. NOTE - not compatible when using the element option. See un for the proper syntax for removing listeners added using the element config.

Defaults to:

false

priority :  Number (optional)

An optional numeric priority that determines the order in which event handlers are run. Event handlers with no priority will be run as if they had a priority of 0. Handlers with a higher priority will be prioritized to run sooner than those with a lower priority. Negative numbers can be used to set a priority lower than the default. Internally, the framework uses a range of 1000 or greater, and -1000 or lesser for handlers that are intended to run before or after all others, so it is recommended to stay within the range of -999 to 999 when setting the priority of event handlers in application-level code. A priority must be an integer to be valid. Fractional values are reserved for internal framework use.

order :  String (optional)

A legacy option that is provided for backward compatibility. It is recommended to use the priority option instead. Available options are:

  • 'before': equal to a priority of 100
  • 'current': equal to a priority of 0 or default priority
  • 'after': equal to a priority of -100

Defaults to:

'current'

order :  String (optional)

A shortcut for the order event option. Provided for backward compatibility. Please use the priority event option instead.

Combining Options

Using the options argument, it is possible to combine different types of listeners:

A delayed, one-time listener.

myPanel.on('hide', this.handleClick, this, {
    single: true,
    delay: 100
});

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 and handler configs.

grid.on({
    itemclick: 'onItemClick',
    itemcontextmenu: grid.onItemContextmenu,
    destroy: {
        fn: function () {
            // function called within the 'altCmp' scope instead of grid
        },
        scope: altCmp // unique scope for the destroy handler
    },
    scope: grid       // default scope - provided for example clarity
});

Delegate

This is a configuration option that you can pass along when registering a handler for an event to assist with event delegation. 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:

var panel = Ext.create({
    xtype: 'panel',
    renderTo: document.body,
    title: 'Delegate Handler Example',
    frame: true,
    height: 220,
    width: 220,
    html: '<h1 class="myTitle">BODY TITLE</h1>Body content'
});

// The click handler will only be called when the click occurs on the
// delegate: h1.myTitle ("h1" tag with class "myTitle")
panel.on({
    click: function (e) {
        console.log(e.getTarget().innerHTML);
    },
    element: 'body',
    delegate: 'h1.myTitle'
 });

Defaults to: 'current'

Returns

:Object

Only when the destroyable option is specified.

A Destroyable object. An object which implements the destroy method which removes all listeners added in this call. For example:

this.btnListeners =  = myButton.on({
    destroyable: true
    mouseover:   function() { console.log('mouseover'); },
    mouseout:    function() { console.log('mouseout'); },
    click:       function() { console.log('click'); }
});

And when those listeners need to be removed:

Ext.destroy(this.btnListeners);

or

this.btnListeners.destroy();

onAfter ( eventName, fn, [scope], [options] )

Appends an after-event handler.

Same as addListener with order set to 'after'.

Parameters

eventName :  String/String[]/Object

The name of the event to listen for.

fn :  Function/String

The method the event invokes.

scope :  Object (optional)

The scope for fn.

options :  Object (optional)

An object containing handler configuration.

onBefore ( eventName, fn, [scope], [options] )

Appends a before-event handler. Returning false from the handler will stop the event.

Same as addListener with order set to 'before'.

Parameters

eventName :  String/String[]/Object

The name of the event to listen for.

fn :  Function/String

The method the event invokes.

scope :  Object (optional)

The scope for fn.

options :  Object (optional)

An object containing handler configuration.

query ( selector, [asDom] ) : HTMLElement[]/Ext.dom.Element[]

Selects child nodes based on the passed CSS selector. Delegates to document.querySelectorAll. More information can be found at http://www.w3.org/TR/css3-selectors/

All selectors, attribute filters and pseudos below can be combined infinitely in any order. For example div.foo:nth-child(odd)[@foo=bar].bar:first would be a perfectly valid selector.

Element Selectors:

  • * any element
  • E an element with the tag E
  • E F All descendant elements of E that have the tag F
  • E > F or E/F all direct children elements of E that have the tag F
  • E + F all elements with the tag F that are immediately preceded by an element with the tag E
  • E ~ F all elements with the tag F that are preceded by a sibling element with the tag E

Attribute Selectors:

The use of @ and quotes are optional. For example, div[@foo='bar'] is also a valid attribute selector.

  • E[foo] has an attribute "foo"
  • E[foo=bar] has an attribute "foo" that equals "bar"
  • E[foo^=bar] has an attribute "foo" that starts with "bar"
  • E[foo$=bar] has an attribute "foo" that ends with "bar"
  • E[foo*=bar] has an attribute "foo" that contains the substring "bar"
  • E[foo%=2] has an attribute "foo" that is evenly divisible by 2
  • E[foo!=bar] has an attribute "foo" that does not equal "bar"

Pseudo Classes:

  • E:first-child E is the first child of its parent
  • E:last-child E is the last child of its parent
  • E:nth-child(n) E is the nth child of its parent (1 based as per the spec)
  • E:nth-child(odd) E is an odd child of its parent
  • E:nth-child(even) E is an even child of its parent
  • E:only-child E is the only child of its parent
  • E:checked E is an element that is has a checked attribute that is true (e.g. a radio or checkbox)
  • E:first the first E in the resultset
  • E:last the last E in the resultset
  • E:nth(n) the nth E in the resultset (1 based)
  • E:odd shortcut for :nth-child(odd)
  • E:even shortcut for :nth-child(even)
  • E:not(S) an E element that does not match simple selector S
  • E:has(S) an E element that has a descendant that matches simple selector S
  • E:next(S) an E element whose next sibling matches simple selector S
  • E:prev(S) an E element whose previous sibling matches simple selector S
  • E:any(S1|S2|S2) an E element which matches any of the simple selectors S1, S2 or S3//\

CSS Value Selectors:

  • E{display=none} CSS value "display" that equals "none"
  • E{display^=none} CSS value "display" that starts with "none"
  • E{display$=none} CSS value "display" that ends with "none"
  • E{display*=none} CSS value "display" that contains the substring "none"
  • E{display%=2} CSS value "display" that is evenly divisible by 2
  • E{display!=none} CSS value "display" that does not equal "none"

Parameters

selector :  String

The CSS selector.

asDom :  Boolean (optional)

false to return an array of Ext.dom.Element

Defaults to: true

Returns

:HTMLElement[]/Ext.dom.Element[]

An Array of elements ( HTMLElement or Ext.dom.Element if asDom is false) that match the selector. If there are no matches, an empty Array is returned.

relayEvents ( origin, events, [prefix] ) : Object

Relays selected events from the specified Observable as if the events were fired by this.

For example if you are extending Grid, you might decide to forward some events from store. So you can do this inside your initComponent:

this.relayEvents(this.getStore(), ['load']);

The grid instance will then have an observable 'load' event which will be passed the parameters of the store's load event and any function fired with the grid's load event would have access to the grid using the this keyword (unless the event is handled by a controller's control/listen event listener in which case 'this' will be the controller rather than the grid).

Parameters

origin :  Object

The Observable whose events this object is to relay.

events :  String[]/Object

Array of event names to relay or an Object with key/value pairs translating to ActualEventName/NewEventName respectively. For example: this.relayEvents(this, {add:'push', remove:'pop'});

Would now redispatch the add event of this as a push event and the remove event as a pop event.

prefix :  String (optional)

A common prefix to prepend to the event names. For example:

this.relayEvents(this.getStore(), ['load', 'clear'], 'store');

Now the grid will forward 'load' and 'clear' events of store as 'storeload' and 'storeclear'.

Returns

:Object

A Destroyable object. An object which implements the destroy method which, when destroyed, removes all relayers. For example:

this.storeRelayers = this.relayEvents(this.getStore(), ['load', 'clear'], 'store');

Can be undone by calling

Ext.destroy(this.storeRelayers);

or this.store.relayers.destroy();

removeListener ( eventName, fn, [scope] )

Removes an event handler.

Parameters

eventName :  String

The type of event the handler was associated with.

fn :  Function

The handler to remove. This must be a reference to the function passed into the addListener call.

scope :  Object (optional)

The scope originally specified for the handler. It must be the same as the scope argument specified in the original call to Ext.util.Observable#addListener or the listener will not be removed.

Convenience Syntax

You can use the addListener destroyable: true config option in place of calling un(). For example:

var listeners = cmp.on({
    scope: cmp,
    afterrender: cmp.onAfterrender,
    beforehide: cmp.onBeforeHide,
    destroyable: true
});

// Remove listeners
listeners.destroy();
// or
cmp.un(
    scope: cmp,
    afterrender: cmp.onAfterrender,
    beforehide: cmp.onBeforeHide
);

Exception - DOM event handlers using the element config option

You must go directly through the element to detach an event handler attached using the addListener element option.

panel.on({
    element: 'body',
    click: 'onBodyCLick'
});

panel.body.un({
    click: 'onBodyCLick'
});

removeManagedListener ( item, ename, [fn], [scope] )

Removes listeners that were added by the mon method.

Parameters

item :  Ext.util.Observable/Ext.dom.Element

The item from which to remove a listener/listeners.

ename :  Object/String

The event name, or an object containing event name properties.

fn :  Function (optional)

If the ename parameter was an event name, this is the handler function.

scope :  Object (optional)

If the ename parameter was an event name, this is the scope (this reference) in which the handler function is executed.

resumeEvent ( eventName )

Resumes firing of the named event(s).

After calling this method to resume events, the events will fire when requested to fire.

Note that if the suspendEvent method is called multiple times for a certain event, this converse method will have to be called the same number of times for it to resume firing.

Parameters

eventName :  String...

Multiple event names to resume.

resumeEvents ( [discardQueue] )

Resumes firing events (see suspendEvents).

If events were suspended using the queueSuspended parameter, then all events fired during event suspension will be sent to any listeners now.

Parameters

discardQueue :  Boolean (optional)

true to prevent any previously queued events from firing while we were suspended. See suspendEvents.

select ( selector, composite ) : Ext.dom.CompositeElementLite/Ext.dom.CompositeElement

Selects descendant elements of this element based on the passed CSS selector to enable Ext.dom.Element methods to be applied to many related elements in one statement through the returned Ext.dom.CompositeElementLite object.

Parameters

selector :  String/HTMLElement[]

The CSS selector or an array of elements

composite :  Boolean

Return a CompositeElement as opposed to a CompositeElementLite. Defaults to false.

Returns

:Ext.dom.CompositeElementLite/Ext.dom.CompositeElement

set ( attributes, [useSet] ) : Ext.dom.Element

Sets the passed attributes as attributes of this element (a style attribute can be a string, object or function).

Example component (though any Ext.dom.Element would suffice):

var cmp = Ext.create({
    xtype: 'component',
    html: 'test',
    renderTo: Ext.getBody()
});

Once the component is rendered, you can fetch a reference to its outer element to use set:

cmp.el.set({
    foo: 'bar'
});

This sets an attribute on the element of foo="bar":

<div class="x-component x-component-default x-border-box" id="component-1009" foo="bar">test</div>

To remove the attribute pass a value of undefined:

cmp.el.set({
    foo: undefined
});

Note:

  • You cannot remove an attribute by passing undefined when the expandos param is set to false.
  • Passing an attribute of style results in the request being handed off to applyStyles.
  • Passing an attribute of cls results in the element's dom's className property being set directly. For additional flexibility when setting / removing classes see:

Parameters

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

setBox ( box ) : Ext.util.Positionable

Sets the element's box.

Parameters

box :  Object

The box to fill {x, y, width, height}

Returns

:Ext.util.Positionable

this

setListeners ( listeners )

An alias for addListener. In versions prior to 5.1, listeners had a generated setter which could be called to add listeners. In 5.1 the listeners config is not processed using the config system and has no generated setter, so this method is provided for backward compatibility. The preferred way of adding listeners is to use the on method.

Parameters

listeners :  Object

The listeners

setLocalX ( x ) : Ext.util.Positionable

Sets the local x coordinate of this element using CSS style. When used on an absolute positioned element this method is symmetrical with getLocalX, but may not be symmetrical when used on a relatively positioned element.

Parameters

x :  Number

The x coordinate. A value of null sets the left style to 'auto'.

Returns

:Ext.util.Positionable

this

setLocalXY ( x, [y] ) : Ext.util.Positionable

Sets the local x and y coordinates of this element using CSS style. When used on an absolute positioned element this method is symmetrical with getLocalXY, but may not be symmetrical when used on a relatively positioned element.

Parameters

x :  Number/Array

The x coordinate or an array containing [x, y]. A value of null sets the left style to 'auto'

y :  Number (optional)

The y coordinate, required if x is not an array. A value of null sets the top style to 'auto'

Returns

:Ext.util.Positionable

this

setLocalY ( y ) : Ext.util.Positionable

Sets the local y coordinate of this element using CSS style. When used on an absolute positioned element this method is symmetrical with getLocalY, but may not be symmetrical when used on a relatively positioned element.

Parameters

y :  Number

The y coordinate. A value of null sets the top style to 'auto'.

Returns

:Ext.util.Positionable

this

setX ( x ) : Ext.util.Positionable

Sets the X position of the DOM element based on page coordinates.

Parameters

x :  Number

The X position

Returns

:Ext.util.Positionable

this

setXY ( pos ) : Ext.util.Positionable

Sets the position of the DOM element in page coordinates.

Parameters

pos :  Number[]

Contains X & Y [x, y] values for new position (coordinates are page-based)

Returns

:Ext.util.Positionable

this

setY ( y ) : Ext.util.Positionable

Sets the Y position of the DOM element based on page coordinates.

Parameters

y :  Number

The Y position

Returns

:Ext.util.Positionable

this

suspendEvent ( eventName )

Suspends firing of the named event(s).

After calling this method to suspend events, the events will no longer fire when requested to fire.

Note that if this is called multiple times for a certain event, the converse method resumeEvent will have to be called the same number of times for it to resume firing.

Parameters

eventName :  String...

Multiple event names to suspend.

suspendEvents ( queueSuspended )

Suspends the firing of all events. (see resumeEvents)

Parameters

queueSuspended :  Boolean

true to queue up suspended events to be fired after the resumeEvents call instead of discarding all suspended events.

translatePoints ( x, [y] ) : Object

Translates the passed page coordinates into left/top css values for the element

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

un ( eventName, fn, [scope] )

Shorthand for removeListener. Removes an event handler.

Parameters

eventName :  String

The type of event the handler was associated with.

fn :  Function

The handler to remove. This must be a reference to the function passed into the addListener call.

scope :  Object (optional)

The scope originally specified for the handler. It must be the same as the scope argument specified in the original call to Ext.util.Observable#addListener or the listener will not be removed.

Convenience Syntax

You can use the addListener destroyable: true config option in place of calling un(). For example:

var listeners = cmp.on({
    scope: cmp,
    afterrender: cmp.onAfterrender,
    beforehide: cmp.onBeforeHide,
    destroyable: true
});

// Remove listeners
listeners.destroy();
// or
cmp.un(
    scope: cmp,
    afterrender: cmp.onAfterrender,
    beforehide: cmp.onBeforeHide
);

Exception - DOM event handlers using the element config option

You must go directly through the element to detach an event handler attached using the addListener element option.

panel.on({
    element: 'body',
    click: 'onBodyCLick'
});

panel.body.un({
    click: 'onBodyCLick'
});

unAfter ( eventName, fn, [scope], [options] )

Removes a before-event handler.

Same as removeListener with order set to 'after'.

Parameters

eventName :  String/String[]/Object

The name of the event the handler was associated with.

fn :  Function/String

The handler to remove.

scope :  Object (optional)

The scope originally specified for fn.

options :  Object (optional)

Extra options object.

unBefore ( eventName, fn, [scope], [options] )

Removes a before-event handler.

Same as removeListener with order set to 'before'.

Parameters

eventName :  String/String[]/Object

The name of the event the handler was associated with.

fn :  Function/String

The handler to remove.

scope :  Object (optional)

The scope originally specified for fn.

options :  Object (optional)

Extra options object.

up ( selector, [limit], [returnDom] ) : Ext.dom.Element/HTMLElement

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.

Parameters

selector :  String

The simple selector to test. See Ext.dom.Query for information about simple selectors.

limit :  Number/String/HTMLElement/Ext.dom.Element (optional)

The max depth to search as a number or an element that causes the upward traversal to stop and is not considered for inclusion as the result. (defaults to 50 || document.documentElement)

returnDom :  Boolean (optional)

True to return the DOM node instead of Ext.dom.Element

Defaults to: false

Returns

:Ext.dom.Element/HTMLElement

The matching DOM node (or HTMLElement if returnDom is true). Or null if no match was found.

Static Methods

fly ( dom, [named] ) : Ext.dom.Element
static sta

Gets the globally shared flyweight Element, with the passed node as the active element. Do not store a reference to this element - the dom node can be overwritten by other code. Ext#fly is alias for Ext.dom.Element#fly.

Use this to make one-time references to DOM elements which are not going to be accessed again either by application code, or by Ext's classes. If accessing an element which will be processed regularly, then Ext.get will be more appropriate to take advantage of the caching provided by the Ext.dom.Element class.

If this method is called with and id or element that has already been cached by a previous call to Ext.get() it will return the cached Element instead of the flyweight instance.

Parameters

dom :  String/HTMLElement

The DOM node or id.

named :  String (optional)

Allows for creation of named reusable flyweights to prevent conflicts (e.g. internally Ext uses "_global").

Returns

:Ext.dom.Element

The shared Element object (or null if no matching element was found).

get ( el ) : Ext.dom.Element
static sta

Retrieves Ext.dom.Element objects. Ext#get is alias for Ext.dom.Element#get.

This method does not retrieve Ext.Components. This method retrieves Ext.dom.Element objects which encapsulate DOM elements. To retrieve a Component by its ID, use Ext.ComponentManager#get.

When passing an id, it should not include the # character that is used for a css selector.

// For an element with id 'foo'
Ext.get('foo'); // Correct
Ext.get('#foo'); // Incorrect

Uses simple caching to consistently return the same object. Automatically fixes if an object was recreated with the same id via AJAX or DOM.

Parameters

el :  String/HTMLElement/Ext.dom.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).

override ( members ) : Ext.Base
static sta

Override members of this class. Overridden methods can be invoked via Ext.Base#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"

Direct use of this method should be rare. 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).

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

query ( selector, [asDom], [root] ) : HTMLElement[]/Ext.dom.Element[]
static sta

Selects child nodes of a given root based on the passed CSS selector.

Parameters

selector :  String

The CSS selector.

asDom :  Boolean (optional)

false to return an array of Ext.dom.Element

Defaults to: true

root :  HTMLElement/String (optional)

The root element of the query or id of the root

Returns

:HTMLElement[]/Ext.dom.Element[]

An Array of elements that match the selector. If there are no matches, an empty Array is returned.

select ( selector, [composite], [root] ) : Ext.dom.CompositeElementLite/Ext.dom.CompositeElement
static sta

Selects elements based on the passed CSS selector to enable Ext.dom.Element methods to be applied to many related elements in one statement through the returned Ext.dom.CompositeElementLite object.

Parameters

selector :  String/HTMLElement[]

The CSS selector or an array of elements

composite :  Boolean (optional)

Return a CompositeElement as opposed to a CompositeElementLite. Defaults to false.

Defaults to: false

root :  HTMLElement/String (optional)

The root element of the query or id of the root

Returns

:Ext.dom.CompositeElementLite/Ext.dom.CompositeElement

events

abort ( e, t, eOpts )

Fires when an object/image is stopped from loading before completely loaded.

Parameters

e :  Ext.event.Event

The Ext.event.Event encapsulating the DOM event.

t :  HTMLElement

The target of the event.

eOpts : Object

The options object passed to Ext.util.Observable.addListener.

blur ( e, t, eOpts )

Fires when an element loses focus either via the pointing device or by tabbing navigation.

Parameters

e :  Ext.event.Event

The Ext.event.Event encapsulating the DOM event.

t :  HTMLElement

The target of the event.

eOpts : Object

The options object passed to Ext.util.Observable.addListener.

change ( e, t, eOpts )

Fires when a control loses the input focus and its value has been modified since gaining focus.

Parameters

e :  Ext.event.Event

The Ext.event.Event encapsulating the DOM event.

t :  HTMLElement

The target of the event.

eOpts : Object

The options object passed to Ext.util.Observable.addListener.

click ( e, t, eOpts )

Fires when a mouse click is detected within the element.

Parameters

e :  Ext.event.Event

The Ext.event.Event encapsulating the DOM event.

t :  HTMLElement

The target of the event.

eOpts : Object

The options object passed to Ext.util.Observable.addListener.

contextmenu ( e, t, eOpts )

Fires when a right click is detected within the element.

Parameters

e :  Ext.event.Event

The Ext.event.Event encapsulating the DOM event.

t :  HTMLElement

The target of the event.

eOpts : Object

The options object passed to Ext.util.Observable.addListener.

dblclick ( e, t, eOpts )

Fires when a mouse double click is detected within the element.

Parameters

e :  Ext.event.Event

The Ext.event.Event encapsulating the DOM event.

t :  HTMLElement

The target of the event.

eOpts : Object

The options object passed to Ext.util.Observable.addListener.

DOMActivate ( e, t, eOpts )

Where supported. Fires when an element is activated, for instance, through a mouse click or a keypress.

Parameters

e :  Ext.event.Event

The Ext.event.Event encapsulating the DOM event.

t :  HTMLElement

The target of the event.

eOpts : Object

The options object passed to Ext.util.Observable.addListener.

DOMAttrModified ( e, t, eOpts )

Where supported. Fires when an attribute has been modified.

Parameters

e :  Ext.event.Event

The Ext.event.Event encapsulating the DOM event.

t :  HTMLElement

The target of the event.

eOpts : Object

The options object passed to Ext.util.Observable.addListener.

DOMCharacterDataModified ( e, t, eOpts )

Where supported. Fires when the character data has been modified.

Parameters

e :  Ext.event.Event

The Ext.event.Event encapsulating the DOM event.

t :  HTMLElement

The target of the event.

eOpts : Object

The options object passed to Ext.util.Observable.addListener.

DOMFocusIn ( e, t, eOpts )

Where supported. Similar to HTML focus event, but can be applied to any focusable element.

Parameters

e :  Ext.event.Event

The Ext.event.Event encapsulating the DOM event.

t :  HTMLElement

The target of the event.

eOpts : Object

The options object passed to Ext.util.Observable.addListener.

DOMFocusOut ( e, t, eOpts )

Where supported. Similar to HTML blur event, but can be applied to any focusable element.

Parameters

e :  Ext.event.Event

The Ext.event.Event encapsulating the DOM event.

t :  HTMLElement

The target of the event.

eOpts : Object

The options object passed to Ext.util.Observable.addListener.

DOMNodeInserted ( e, t, eOpts )

Where supported. Fires when a node has been added as a child of another node.

Parameters

e :  Ext.event.Event

The Ext.event.Event encapsulating the DOM event.

t :  HTMLElement

The target of the event.

eOpts : Object

The options object passed to Ext.util.Observable.addListener.

DOMNodeInsertedIntoDocument ( e, t, eOpts )

Where supported. Fires when a node is being inserted into a document.

Parameters

e :  Ext.event.Event

The Ext.event.Event encapsulating the DOM event.

t :  HTMLElement

The target of the event.

eOpts : Object

The options object passed to Ext.util.Observable.addListener.

DOMNodeRemoved ( e, t, eOpts )

Where supported. Fires when a descendant node of the element is removed.

Parameters

e :  Ext.event.Event

The Ext.event.Event encapsulating the DOM event.

t :  HTMLElement

The target of the event.

eOpts : Object

The options object passed to Ext.util.Observable.addListener.

DOMNodeRemovedFromDocument ( e, t, eOpts )

Where supported. Fires when a node is being removed from a document.

Parameters

e :  Ext.event.Event

The Ext.event.Event encapsulating the DOM event.

t :  HTMLElement

The target of the event.

eOpts : Object

The options object passed to Ext.util.Observable.addListener.

DOMSubtreeModified ( e, t, eOpts )

Where supported. Fires when the subtree is modified.

Parameters

e :  Ext.event.Event

The Ext.event.Event encapsulating the DOM event.

t :  HTMLElement

The target of the event.

eOpts : Object

The options object passed to Ext.util.Observable.addListener.

doubletap ( event, node, options, eOpts )

Fires when there is a double tap.

Parameters

event :  Ext.event.Event

The Ext.event.Event event encapsulating the DOM event.

node :  HTMLElement

The target of the event.

options :  Object

The options object passed to Ext.mixin.Observable.addListener.

eOpts : Object

The options object passed to Ext.util.Observable.addListener.

error ( e, t, eOpts )

Fires when an object/image/frame cannot be loaded properly.

Parameters

e :  Ext.event.Event

The Ext.event.Event encapsulating the DOM event.

t :  HTMLElement

The target of the event.

eOpts : Object

The options object passed to Ext.util.Observable.addListener.

focus ( e, t, eOpts )

Fires when an element receives focus either via the pointing device or by tab navigation.

Parameters

e :  Ext.event.Event

The Ext.event.Event encapsulating the DOM event.

t :  HTMLElement

The target of the event.

eOpts : Object

The options object passed to Ext.util.Observable.addListener.

focusmove ( e, t, eOpts )

Fires when focus is moved within an element.

Parameters

e :  Ext.event.Event

The Ext.event.Event encapsulating the DOM event.

target :  Ext.dom.Element

The Ext.dom.Element element which recieved focus.

relatedTarget :  Ext.dom.Element

The Ext.dom.Element element which lost focus.

t :  HTMLElement

The target of the event.

eOpts : Object

The options object passed to Ext.util.Observable.addListener.

keydown ( e, t, eOpts )

Fires when a keydown is detected within the element.

Parameters

e :  Ext.event.Event

The Ext.event.Event encapsulating the DOM event.

t :  HTMLElement

The target of the event.

eOpts : Object

The options object passed to Ext.util.Observable.addListener.

keypress ( e, t, eOpts )

Fires when a keypress is detected within the element.

Parameters

e :  Ext.event.Event

The Ext.event.Event encapsulating the DOM event.

t :  HTMLElement

The target of the event.

eOpts : Object

The options object passed to Ext.util.Observable.addListener.

keyup ( e, t, eOpts )

Fires when a keyup is detected within the element.

Parameters

e :  Ext.event.Event

The Ext.event.Event encapsulating the DOM event.

t :  HTMLElement

The target of the event.

eOpts : Object

The options object passed to Ext.util.Observable.addListener.

load ( e, t, eOpts )

Fires when the user agent finishes loading all content within the element. Only supported by window, frames, objects and images.

Parameters

e :  Ext.event.Event

The Ext.event.Event encapsulating the DOM event.

t :  HTMLElement

The target of the event.

eOpts : Object

The options object passed to Ext.util.Observable.addListener.

longpress ( event, node, options, eOpts )

Fires when you touch and hold still for more than 1 second.

Parameters

event :  Ext.event.Event

The Ext.event.Event event encapsulating the DOM event.

node :  HTMLElement

The target of the event.

options :  Object

The options object passed to Ext.mixin.Observable.addListener.

eOpts : Object

The options object passed to Ext.util.Observable.addListener.

mousedown ( e, t, eOpts )

Fires when a mousedown is detected within the element.

Parameters

e :  Ext.event.Event

The Ext.event.Event encapsulating the DOM event.

t :  HTMLElement

The target of the event.

eOpts : Object

The options object passed to Ext.util.Observable.addListener.

mouseenter ( e, t, eOpts )

Fires when the mouse enters the element.

Parameters

e :  Ext.event.Event

The Ext.event.Event encapsulating the DOM event.

t :  HTMLElement

The target of the event.

eOpts : Object

The options object passed to Ext.util.Observable.addListener.

mouseleave ( e, t, eOpts )

Fires when the mouse leaves the element.

Parameters

e :  Ext.event.Event

The Ext.event.Event encapsulating the DOM event.

t :  HTMLElement

The target of the event.

eOpts : Object

The options object passed to Ext.util.Observable.addListener.

mousemove ( e, t, eOpts )

Fires when a mousemove is detected with the element.

Parameters

e :  Ext.event.Event

The Ext.event.Event encapsulating the DOM event.

t :  HTMLElement

The target of the event.

eOpts : Object

The options object passed to Ext.util.Observable.addListener.

mouseout ( e, t, eOpts )

Fires when a mouseout is detected with the element.

Parameters

e :  Ext.event.Event

The Ext.event.Event encapsulating the DOM event.

t :  HTMLElement

The target of the event.

eOpts : Object

The options object passed to Ext.util.Observable.addListener.

mouseover ( e, t, eOpts )

Fires when a mouseover is detected within the element.

Parameters

e :  Ext.event.Event

The Ext.event.Event encapsulating the DOM event.

t :  HTMLElement

The target of the event.

eOpts : Object

The options object passed to Ext.util.Observable.addListener.

mouseup ( e, t, eOpts )

Fires when a mouseup is detected within the element.

Parameters

e :  Ext.event.Event

The Ext.event.Event encapsulating the DOM event.

t :  HTMLElement

The target of the event.

eOpts : Object

The options object passed to Ext.util.Observable.addListener.

painted ( this, eOpts )

Fires whenever this Element actually becomes visible (painted) on the screen. This is useful when you need to perform 'read' operations on the DOM element, i.e: calculating natural sizes and positioning.

Note: This event is not available to be used with event delegation. Instead painted only fires if you explicitly add at least one listener to it, for performance reasons.

Parameters

this :  Ext.dom.Element

The component instance.

eOpts : Object

The options object passed to Ext.util.Observable.addListener.

pinch ( event, node, options, eOpts )

Fires continuously when there is pinching (the touch must move for this to be fired).

Parameters

event :  Ext.event.Event

The Ext.event.Event event encapsulating the DOM event.

node :  HTMLElement

The target of the event.

options :  Object

The options object passed to Ext.mixin.Observable.addListener.

eOpts : Object

The options object passed to Ext.util.Observable.addListener.

pinchend ( event, node, options, eOpts )

Fires when a pinch has ended.

Parameters

event :  Ext.event.Event

The Ext.event.Event event encapsulating the DOM event.

node :  HTMLElement

The target of the event.

options :  Object

The options object passed to Ext.mixin.Observable.addListener.

eOpts : Object

The options object passed to Ext.util.Observable.addListener.

pinchstart ( event, node, options, eOpts )

Fired once when a pinch has started.

Parameters

event :  Ext.event.Event

The Ext.event.Event event encapsulating the DOM event.

node :  HTMLElement

The target of the event.

options :  Object

The options object passed to Ext.mixin.Observable.addListener.

eOpts : Object

The options object passed to Ext.util.Observable.addListener.

reset ( e, t, eOpts )

Fires when a form is reset.

Parameters

e :  Ext.event.Event

The Ext.event.Event encapsulating the DOM event.

t :  HTMLElement

The target of the event.

eOpts : Object

The options object passed to Ext.util.Observable.addListener.

resize ( this, eOpts )

Important note: For the best performance on mobile devices, use this only when you absolutely need to monitor a Element's size.

Note: This event is not available to be used with event delegation. Instead resize only fires if you explicitly add at least one listener to it, for performance reasons.

Parameters

this :  Ext.dom.Element

The component instance.

eOpts : Object

The options object passed to Ext.util.Observable.addListener.

rotate ( event, node, options, eOpts )

Fires continuously when there is rotation (the touch must move for this to be fired). When listening to this, ensure you know about the Ext.event.Event#angle and Ext.event.Event#rotation properties in the event object.

Parameters

event :  Ext.event.Event

The Ext.event.Event event encapsulating the DOM event.

node :  HTMLElement

The target of the event.

options :  Object

The options object passed to Ext.mixin.Observable.addListener.

eOpts : Object

The options object passed to Ext.util.Observable.addListener.

rotateend ( event, node, options, eOpts )

Fires when a rotation event has ended.

Parameters

event :  Ext.event.Event

The Ext.event.Event event encapsulating the DOM event.

node :  HTMLElement

The target of the event.

options :  Object

The options object passed to Ext.mixin.Observable.addListener.

eOpts : Object

The options object passed to Ext.util.Observable.addListener.

rotatestart ( event, node, options, eOpts )

Fired once when a rotation has started.

Parameters

event :  Ext.event.Event

The Ext.event.Event event encapsulating the DOM event.

node :  HTMLElement

The target of the event.

options :  Object

The options object passed to Ext.mixin.Observable.addListener.

eOpts : Object

The options object passed to Ext.util.Observable.addListener.

scroll ( e, t, eOpts )

Fires when a document view is scrolled.

Parameters

e :  Ext.event.Event

The Ext.event.Event encapsulating the DOM event.

t :  HTMLElement

The target of the event.

eOpts : Object

The options object passed to Ext.util.Observable.addListener.

select ( e, t, eOpts )

Fires when a user selects some text in a text field, including input and textarea.

Parameters

e :  Ext.event.Event

The Ext.event.Event encapsulating the DOM event.

t :  HTMLElement

The target of the event.

eOpts : Object

The options object passed to Ext.util.Observable.addListener.

singletap ( event, node, options, eOpts )

Fires when there is a single tap.

Parameters

event :  Ext.event.Event

The Ext.event.Event event encapsulating the DOM event.

node :  HTMLElement

The target of the event.

options :  Object

The options object passed to Ext.mixin.Observable.addListener.

eOpts : Object

The options object passed to Ext.util.Observable.addListener.

submit ( e, t, eOpts )

Fires when a form is submitted.

Parameters

e :  Ext.event.Event

The Ext.event.Event encapsulating the DOM event.

t :  HTMLElement

The target of the event.

eOpts : Object

The options object passed to Ext.util.Observable.addListener.

swipe ( event, node, options, eOpts )

Fires when there is a swipe When listening to this, ensure you know about the Ext.event.Event#direction property in the event object.

Parameters

event :  Ext.event.Event

The Ext.event.Event event encapsulating the DOM event.

node :  HTMLElement

The target of the event.

options :  Object

The options object passed to Ext.mixin.Observable.addListener.

eOpts : Object

The options object passed to Ext.util.Observable.addListener.

taphold ( event, node, options, eOpts )

Fires when you touch and hold still for more than 1 second.

Parameters

event :  Ext.event.Event

The Ext.event.Event event encapsulating the DOM event.

node :  HTMLElement

The target of the event.

options :  Object

The options object passed to Ext.mixin.Observable.addListener.

eOpts : Object

The options object passed to Ext.util.Observable.addListener.

unload ( e, t, eOpts )

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.

Parameters

e :  Ext.event.Event

The Ext.event.Event encapsulating the DOM event.

t :  HTMLElement

The target of the event.

eOpts : Object

The options object passed to Ext.util.Observable.addListener.

ExtReact 6.6.0