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.
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.
Public classes and class members are available for use by any other class or application code and may be relied upon as a stable and persistent within major product versions. Public classes and members may safely be extended via a subclass.
Protected class members are stable public
members intended to be used by the
owning class or its subclasses. Protected members may safely be extended via a subclass.
Private classes and class members are used internally by the framework and are not intended to be used by application developers. Private classes and members may change or be omitted from the framework at any time without notice and should not be relied upon in application logic.
static
label next to the
method name. *See Static below.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).
Let's look at each part of the member row:
lookupComponent
in this example)( item )
in this example)Ext.Component
in this case). This may be omitted for methods that do not
return anything other than undefined
or may display as multiple possible values
separated by a forward slash /
signifying that what is returned may depend on the
results of the method call (i.e. a method may return a Component if a get method calls is
successful or false
if unsuccessful which would be displayed as
Ext.Component/Boolean
).PROTECTED
in
this example - see the Flags section below)Ext.container.Container
in this example). The source
class will be displayed as a blue link if the member originates from the current class
and gray if it is inherited from an ancestor or mixed-in class.view source
in the example)item : Object
in the example).undefined
a "Returns" section
will note the type of class or object returned and a description (Ext.Component
in the
example)Available since 3.4.0
- not pictured in
the example) just after the member descriptionDefaults to: false
)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.
classInstance.method1().method2().etc();
false
is returned from
an event handler- 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
- Indicates a class member of type config
- 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
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.
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.
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.
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.
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:
Ext.button.Button
class has an alternate class name of Ext.Button
). Alternate class
names are commonly maintained for backward compatibility.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.
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:
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.
An incrementing numeric counter indicating activation index for use by the zIndexManager to sort its stack.
Defaults to:
0
A Component or Element by which to position this component according to the defaultAlign. Defaults to the owning Container.
Only applicable if this component is floating
Used upon first show.
Defaults to:
null
A flag indicating that this component should be on the top of the z-index stack for use by the zIndexManager to sort its stack.
This may be a positive number to prioritize the ordering of multiple visible always on top components.
This may be set to a negative number to prioritize a component to the bottom of the z-index stack.
Defaults to:
false
This is a layout that enables anchoring of contained elements relative to the container's dimensions.
If the container is resized, all anchored items are automatically rerendered according to their
anchor
rules.
This class is intended to be extended or created via the layout: 'anchor' config, and should generally not need to be created directly via the new keyword.
AnchorLayout does not have any direct config options (other than inherited ones). By default,
AnchorLayout will calculate anchor measurements based on the size of the container itself. However, the
container using the AnchorLayout can supply an anchoring-specific config property of anchorSize
.
If anchorSize is specifed, the layout will use it as a virtual container for the purposes of calculating anchor measurements based on it instead, allowing the container to be sized independently of the anchoring logic if necessary.
true
to animate the shadow along with the component while the component is animating.
By default the shadow is hidden while the component is animating
Defaults to:
false
A tag name or Ext.dom.Helper spec used to create the Element which will encapsulate this Component.
You do not normally need to specify this. For the base classes Ext.Component and Ext.container.Container, this defaults to 'div'. The more complex Sencha classes use a more complex DOM structure specified by their own renderTpls.
This is intended to allow the developer to create application-specific utility Components encapsulated by different DOM elements. Example usage:
{
xtype: 'component',
autoEl: {
tag: 'img',
src: 'http://www.example.com/example.jpg'
}
}, {
xtype: 'component',
autoEl: {
tag: 'blockquote',
html: 'autoEl is cool!'
}
}, {
xtype: 'container',
autoEl: 'ul',
cls: 'ux-unordered-list',
items: {
xtype: 'component',
autoEl: 'li',
html: 'First list item'
}
}
Available since: 2.3.0
This config is intended mainly for non-cfg-floating Components which may or may not be shown. Instead of using
renderTo in the configuration, and rendering upon construction, this allows a Component to render itself
upon first show. If cfg-floating is true
, the value of this config is omitted as if it is true
.
Specify as true
to have this Component render to the document body upon first show.
Specify as an element, or the ID of an element to have this Component render to a specific element upon first show.
Defaults to:
false
true
to use overflow:'auto' on the components layout element and show scroll bars automatically when necessary,
false
to clip any overflowing content.
This should not be combined with overflowX or overflowY.
Defaults to:
false
Deprecated since version 5.1.0
Use scrollable instead
Sets the overflow on the content element of the component.
scroll : Boolean
True to allow the Component to auto scroll.
this
Deprecated since version 5.0.0
Use setScrollable instead
true
to automatically show the component upon creation. This config option may only be used for
floating components or components that use autoRender.
Defaults to:
false
Available since: 2.3.0
The base CSS class to apply to this component's element. This will also be prepended to elements within this
component like Panel's body will get a class x-panel-body
. This means that if you create a subclass of Panel, and
you want it to get all the Panels styling for the element and the body, you leave the baseCls
x-panel
and use
componentCls
to add specific styling for this component.
Defaults to:
'x-component'
Setting this config option adds or removes data bindings for other configs.
For example, to bind the title
config:
var panel = Ext.create({
xtype: 'panel',
bind: {
title: 'Hello {user.name}'
}
});
To dynamically add bindings:
panel.setBind({
title: 'Greetings {user.name}!'
});
To remove bindings:
panel.setBind({
title: null
});
The bind expressions are presented to Ext.app.ViewModel#bind
. The
ViewModel
instance is determined by lookupViewModel
.
Note: If bind is passed as a string, it will use the Ext.Component#property-defaultBindProperty for the binding
Defaults to:
null
Specifies the border size for this component. The border can be a single numeric value to apply to all sides or it can be a CSS style specification for each style, for example: '10 5 3 10' (top, right, bottom, left).
For components that have no border by default, setting this won't make the border appear by itself. You also need to specify border color and style:
border: 5,
style: {
borderColor: 'red',
borderStyle: 'solid'
}
To turn off the border, use border: false
.
The canonical form of childEls
is an object keyed by child's property name
with values that are objects with the following properties.
itemId
- The id to combine with the Component's id that is the id of the
child element.id
- The id of the child element.leaf
- Set to true
to ignore content when scanning for childEls. This
should be set on things like the generated content for an Ext.view.View
.select
: A selector that will be passed to Ext.dom.Element#method-select.selectNode
: A selector that will be passed to Ext.dom.Element#method-selectNode.For example:
childEls: {
button: true,
buttonText: 'text',
buttonImage: {
itemId: 'image'
}
}
The above is translated into the following complete form:
childEls: {
button: {
name: 'button',
itemId: 'button'
},
buttonText: {
name: 'buttonText',
itemId: 'text'
},
buttonImage: {
name: 'buttonImage',
itemId: 'image'
}
}
The above can be provided as an array like so:
childEls: [
'button',
{ name: 'buttonText', itemId: 'text' },
{ name: 'buttonImage', itemId: 'image' }
}
For example, a Component which renders a title and body text:
When using select
, the property will be an instance of Ext.CompositeElement.
In all other cases, the property will be an Ext.dom.Element or null
if not found.
Care should be taken when using select
or selectNode
to find child elements.
The following issues should be considered:
This above issues are most important when using select
since it returns multiple
elements.
Defaults to:
{ frameTable: { frame: true }, frameTL: { frame: 'tl' }, frameTC: { frame: 'tc' }, frameTR: { frame: 'tr' }, frameML: { frame: 'ml' }, frameBody: { frame: 'mc' }, frameMR: { frame: 'mr' }, frameBL: { frame: 'bl' }, frameBC: { frame: 'bc' }, frameBR: { frame: 'br' } }
An optional extra CSS class that will be added to this component's Element. The value can be a string, a list of strings separated by spaces, or an array of strings. This can be useful for adding customized styles to the component or any of its children using standard CSS rules.
Defaults to:
''
Available since: 1.1.0
True to enable dblclick to toggle expand and collapse on the collapseTarget Panel.
Defaults to:
true
A string describing the relative position of the immediate sibling Panel to collapse. May be 'prev' or 'next'.
Or the immediate sibling Panel to collapse.
The orientation of the mini-collapse tool will be inferred from this setting.
Note that only Panels may be collapsed.
Defaults to:
'next'
True to show a mini-collapse tool in the Splitter to toggle expand and collapse on the collapseTarget Panel. Defaults to the collapsible setting of the Panel.
Defaults to:
null
Defines the column width inside Ext.layout.container.Column.
The columnWidth property is always evaluated as a percentage and must be a decimal value greater than 0 and less than 1 (e.g., .25). See the description at the top of Ext.layout.container.Column for additional usage details when combining width and columnWidth configs within the layout.
CSS Class to be added to a components root level element to give distinction to it via styling.
The sizing and positioning of a Component's internal Elements is the responsibility of the Component's layout manager which sizes a Component's internal structure in response to the Component being sized.
Generally, developers will not use this configuration as all provided Components which need their internal elements sizing (Such as Ext.form.field.Base) come with their own componentLayout managers.
The Ext.layout.container.Auto will be used on instances of the base Ext.Component class which simply sizes the Component's encapsulating element to the height and width specified in the setSize method.
Defaults to:
'autocomponent'
True to constrain this Components within its containing element, false to allow it to fall outside of its containing
element. By default this Component will be rendered to document.body
. To render and constrain this Component within
another element specify renderTo.
Defaults to:
false
An object or a string (in TRBL order) specifying insets from the configured constrain region within which this component must be constrained when positioning or sizing. example:
constraintInsets: '10 10 10 10' // Constrain with 10px insets from parent
A Ext.util.Region (or an element from which a Region measurement will be read) which is used to constrain the component. Only applies when the component is floating.
Specify an existing HTML element, or the id
of an existing HTML element to use as the content for this component.
This config option is used to take an existing HTML element and place it in the layout element of a new component (it simply moves the specified DOM element after the Component is rendered to use as the content.
Notes:
The specified HTML element is appended to the layout element of the component after any configured HTML has been inserted, and so the document will not contain this element at the time the event-render event is fired.
The specified HTML element used will not participate in any layout
scheme that the Component may use. It is just HTML. Layouts operate on child
items
.
Add either the x-hidden
or the x-hidden-display
CSS class to prevent a brief flicker of the content before it
is rendered to the panel.
Available since: 3.4.0
A string alias, a configuration object or an instance of a ViewController
for
this container. Sample usage:
Ext.define('MyApp.UserController', {
alias: 'controller.user'
});
Ext.define('UserContainer', {
extend: 'Ext.container.container',
controller: 'user'
});
// Or
Ext.define('UserContainer', {
extend: 'Ext.container.container',
controller: {
type: 'user',
someConfig: true
}
});
// Can also instance at runtime
var ctrl = new MyApp.UserController();
var view = new UserContainer({
controller: ctrl
});
Defaults to:
null
Sets the value of controller
controller : String / Object / Ext.app.ViewController
The initial set of data to apply to the tpl
to update the content
area of the Component.
Defaults to:
null
Available since: 3.4.0
The default Ext.dom.Element#getAlignToXY anchor position value for this component relative to its alignTarget (which defaults to its owning Container).
Only applicable if this component is floating
Used upon first show.
Defaults to:
"c-c"
If true
, this component will be the default scope (this pointer) for events
specified with string names so that the scope can be dynamically resolved. The
component will automatically become the defaultListenerScope if a
controller is specified.
See the introductory docs for Ext.container.Container for some sample usages.
NOTE: This value can only be reliably set at construction time. Setting it after that time may not correctly rewire all of the potentially effected listeners.
Defaults to:
false
Sets the value of defaultListenerScope
defaultListenerScope : Boolean
Provides a default maximum width or height for the two components that the splitter is between.
Defaults to:
1000
Provides a default minimum width or height for the two components that the splitter is between.
Defaults to:
40
true
to disable the component.
Defaults to:
false
Available since: 2.3.0
Enable or disable the component.
disabled : Boolean
true
to disable.
CSS class to add when the Component is disabled.
Defaults to:
'x-item-disabled'
The side of the Ext.panel.Panel where this component is to be docked when specified in the panel's dockedItems config.
Possible values are:
Sets the dock position of this component in its parent panel. Note that this only has effect if this item is part
of the dockedItems
collection of a parent that has a DockLayout (note that any Panel has a DockLayout by default)
dock : Object
The dock position.
this
Specify as true to make a floating Component draggable using the Component's encapsulating element as the drag handle.
This may also be specified as a config object for the Ext.util.ComponentDragger which is instantiated to perform dragging.
For example to create a Component which may only be dragged around using a certain internal element as the drag handle, use the delegate option:
new Ext.Component({
constrain: true,
floating: true,
style: {
backgroundColor: '#fff',
border: '1px solid black'
},
html: '<h1 style="cursor:move">The title</h1><p>The content</p>',
draggable: {
delegate: 'h1'
}
}).show();
Defaults to:
false
Configure as true
to have this Component fixed at its X, Y
coordinates in the browser viewport, immune
to scrolling the document.
Defaults to:
false
Flex may be applied to child items of a box layout (Ext.layout.container.VBox or
Ext.layout.container.HBox). Each child item with a flex property will
fill space (horizontally in hbox
, vertically in vbox
) according to that item's
relative flex value compared to the sum of all items with a flex value specified.
Any child items that have either a flex
of 0
or undefined
will not be 'flexed' (the initial size will not be changed).
Sets the flex property of this component. Only applicable when this component is an item of a box layout
flex : Number
Specify as true to float the Component outside of the document flow using CSS absolute positioning.
Components such as Ext.window.Windows and Ext.menu.Menus are floating by default.
Floating Components that are programmatically rendered will register themselves with the global Ext.WindowManager
A floating Component may be used as a child item of a Container. This just allows the floating Component to seek a ZIndexManager by examining the ownerCt chain.
When configured as floating, Components acquire, at render time, a Ext.ZIndexManager which manages a stack of related floating Components. The ZIndexManager sorts its stack according to an incrementing access counter and the alwaysOnTop config when the Component's toFront method is called.
The ZIndexManager is found by traversing up the ownerCt chain to find an ancestor which itself is floating. This is so that descendant floating Components of floating Containers (Such as a ComboBox dropdown within a Window) can have its zIndex managed relative to any siblings, but always above that floating ancestor Container.
If no floating ancestor is found, a floating Component registers itself with the default Ext.WindowManager.
Floating components do not participate in the Container's layout. Because of this, they are not rendered until you explicitly method-show them.
After rendering, the ownerCt reference is deleted, and the floatParent property is set to the found floating ancestor Container. If no floating ancestor Container was found the floatParent property will not be set.
Defaults to:
false
CSS class that will be added to focused Component, and removed when Component blurs.
Defaults to:
'x-focus'
Specifies whether the floated component should be automatically focused when it is brought to the front.
Defaults to:
true
When inside FormPanel, any component configured with formBind: true
will
be enabled/disabled depending on the validity state of the form.
See Ext.form.Panel for more information and example.
Defaults to:
false
Specify as true
to have the Component inject framing elements within the Component at render time to provide a
graphical rounded frame around the Component content.
This is only necessary when running on outdated, or non standard-compliant browsers such as Microsoft's Internet Explorer prior to version 9 which do not support rounded corners natively.
The extra space taken up by this framing is available from the read only property frameSize.
The height of this component. A numeric value will be interpreted as the number of pixels; a string value will be treated as a CSS value with units.
Sets the height of the component. This method fires the resize event.
height : Number
The new height to set. This may be one of:
undefined
to leave the height unchanged.null
to clear the height.this
A String which specifies how this Component's encapsulating DOM element will be hidden. Values may be:
'display'
: The Component will be hidden using the display: none
style.'visibility'
: The Component will be hidden using the visibility: hidden
style.'offsets'
: The Component will be hidden by absolutely positioning it out of the visible area of the document.
This is useful when a hidden Component must maintain measurable dimensions. Hiding using display
results in a
Component having zero dimensions.Defaults to:
'display'
Available since: 1.1.0
An HTML fragment, or a Ext.dom.Helper specification to use as the layout element content. The HTML content is added after the component is rendered, so the document will not contain this HTML at the time the event-render event is fired. This content is inserted into the body before any configured contentEl is appended.
Defaults to:
''
Available since: 3.4.0
The unique id of this component instance.
Use of this config should be considered carefully as this value must be unique across
all existing components. Components created with an id
may be accessed globally
using Ext.getCmp.
Instead of using assigned ids, consider a reference config and a ViewController to respond to events and perform processing upon this Component.
Alternatively, itemId and Ext.ComponentQuery can be used to perform selector-based searching for Components analogous to DOM querying. The Ext.container.Container class contains several helpful shortcut methods to query its descendant Components by selector.
Note that this id
will also be used as the element id for the containing HTML
element that is rendered to the page for this component. This allows you to write
id-based CSS rules to style the specific instance of this component uniquely, and
also to select sub-elements using this component's id
as the parent.
Defaults to an auto-assigned id.
Note: Valid identifiers start with a letter or underscore and are followed by (optional) additional letters, underscores, digits or hyphens.
Available since: 1.1.0
The unique id of this component instance within its container. See also the reference config.
An itemId
can be used as an alternative way to get a reference to a component when no object reference is
available. Instead of using an id
with getCmp, use
itemId
with getComponent which will
retrieve itemId
's or id's. Since itemId
's are an index to the container's
internal collection, the itemId
is scoped locally to the container -- avoiding
potential conflicts with Ext.ComponentManager, which requires a unique
id value.
var c = new Ext.panel.Panel({ //
height: 300,
renderTo: document.body,
layout: 'auto',
items: [
{
itemId: 'p1',
title: 'Panel 1',
height: 150
},
{
itemId: 'p2',
title: 'Panel 2',
height: 150
}
]
})
p1 = c.getComponent('p1'); // not the same as Ext.getCmp()
p2 = p1.ownerCt.getComponent('p2'); // reference via a sibling
Also see id, Ext.container.Container#query
, Ext.container.Container#down
and
Ext.container.Container#child
.
Note: Valid identifiers start with a letter or underscore and are followed by (optional) additional letters, underscores, digits or hyphens.
Note: to access the container of an item see ownerCt.
Available since: 3.4.0
Components that achieve their internal layout results using solely CSS with no JS
intervention must set this to true. This allows the component to opt out of the
layout run when used inside certain container layouts such as Ext.layout.container.Form and Ext.layout.container.Auto
resulting in a performance gain. The following components currently use liquid
layout (liquidLayout: true
):
It is important to keep in mind that components using liquidLayout do not fire the following events:
In addition liquidLayout components do not call the following template methods:
Any component that needs to fire these events or to have these methods called during
its life cycle needs to set liquidLayout
to false
. The following example
demonstrates how to enable the resize event for a
Ext.form.field.TextArea:
Use caution when setting liquidLayout
to false
as it carries a performance penalty
since it means the layout system must perform expensive DOM reads to determine the
Component's size.
Defaults to:
false
A config object containing one or more event handlers to be added to this object during initialization. This should be a valid listeners config object as specified in the addListener example for attaching multiple handlers at once.
DOM events from Ext JS Ext.Component
While some Ext JS Component classes export selected DOM events (e.g. "click", "mouseover" etc), this is usually
only done when extra value can be added. For example the Ext.view.View's itemclick
event passing the node clicked on. To access DOM events directly from a
child element of a Component, we need to specify the element
option to identify the Component property to add a
DOM listener to:
new Ext.panel.Panel({
width: 400,
height: 200,
dockedItems: [{
xtype: 'toolbar'
}],
listeners: {
click: {
element: 'el', //bind to the underlying el property on the panel
fn: function(){ console.log('click el'); }
},
dblclick: {
element: 'body', //bind to the underlying body property on the panel
fn: function(){ console.log('dblclick body'); }
}
}
});
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.
listeners : Object
The listeners
True to drag the component itself. Else a lightweight version of the component will be shown (using the component's ghost() method).
Note: This config is only relevant when used with dragging implemented via Ext.util.ComponentDragger.
Defaults to:
false
A configuration object or an instance of a Ext.ComponentLoader to load remote content for this Component.
Ext.create('Ext.Component', {
loader: {
url: 'content.html',
autoLoad: true
},
renderTo: Ext.getBody()
});
Gets the Ext.ComponentLoader for this Component.
The loader instance, null if it doesn't exist.
Specifies the margin for this component. The margin can be a single numeric value to apply to all sides or it can be a CSS style specification for each style, for example: '10 5 3 10' (top, right, bottom, left).
Related to the cfg-childEls configuration which specifies named properties which correspond to component sub-elements.
The name of the element property in this component to mask when masked by a LoadMask.
Defaults to null
to indicate that Components cannot by default contain a LoadMask, and that any LoadMask should be rendered into the document body.
For example, Panels use "el"
to indicate that the whole panel should be masked. This could be configured to be
"body"
so that only the body is masked and toolbars and the header are still mouse-accessible.
Defaults to:
null
The maximum value in pixels which this Component will set its height to.
Warning: This will override any size management applied by layout managers.
Defaults to:
null
The maximum value in pixels which this Component will set its width to.
Warning: This will override any size management applied by layout managers.
Defaults to:
null
The minimum value in pixels which this Component will set its height to.
Warning: This will override any size management applied by layout managers.
Defaults to:
null
The minimum value in pixels which this Component will set its width to.
Warning: This will override any size management applied by layout managers.
Defaults to:
null
True to make the floated component modal and mask everything behind it when displayed, false to display it without restricting access to other UI elements.
Defaults to:
false
This config enables binding to your Ext.data.Model#validators
. This
is only processed by form fields (e.g., Ext.form.field.Text
) at present, but
this setting is inherited and so can be set on a parent container.
When set to true
by a component or not set by a component but inherited from
an ancestor container, Ext.data.Validation
records are used to automatically
bind validation results for any form field to which a value
is bound.
While this config can be set arbitrarily high in the component hierarchy, doing
so can create a lot overhead if most of your form fields do not actually rely on
validators
in your data model.
Using this setting for a form that is bound to an Ext.data.Model
might look
like this:
{
xtype: 'panel',
modelValidation: true,
items: [{
xtype: 'textfield',
bind: '{theUser.firstName}'
},{
xtype: 'textfield',
bind: '{theUser.lastName}'
},{
xtype: 'textfield',
bind: '{theUser.phoneNumber}'
},{
xtype: 'textfield',
bind: '{theUser.email}'
}]
}
The above is equivalent to the following manual binding of validation:
{
xtype: 'panel',
items: [{
xtype: 'textfield',
bind: {
value: '{theUser.firstName}'
validation: '{theUser.validation.firstName}'
}
},{
xtype: 'textfield',
bind: {
value: '{theUser.lastName}'
validation: '{theUser.validation.lastName}'
}
},{
xtype: 'textfield',
bind: {
value: '{theUser.phoneNumber}'
validation: '{theUser.validation.phoneNumber}'
}
},{
xtype: 'textfield',
bind: {
value: '{theUser.email}'
validation: '{theUser.validation.email}'
}
}]
}
Notice that "validation" is a pseudo-association defined for all entities. See
Ext.data.Model#getValidation
for further details.
An optional extra CSS class that will be added to this component's Element when the mouse moves over the Element, and removed when the mouse moves out. This can be useful for adding customized 'active' or 'hover' styles to the component or any of its children using standard CSS rules.
Defaults to:
''
Available since: 2.3.0
Possible values are:
'auto'
to enable automatic horizontal scrollbar (Style overflow-x: 'auto').'scroll'
to always enable horizontal scrollbar (Style overflow-x: 'scroll').The default is overflow-x: 'hidden'. This should not be combined with autoScroll.
Deprecated since version 5.1.0
Use scrollable instead
Possible values are:
'auto'
to enable automatic vertical scrollbar (Style overflow-y: 'auto').'scroll'
to always enable vertical scrollbar (Style overflow-y: 'scroll').The default is overflow-y: 'hidden'. This should not be combined with autoScroll.
Deprecated since version 5.1.0
Use scrollable instead
Specifies the padding for this component. The padding can be a single numeric value to apply to all sides or it can be a CSS style specification for each style, for example: '10 5 3 10' (top, right, bottom, left).
Set to false to prevent this Splitter's mini-collapse tool from managing the collapse state of the collapseTarget.
An array of plugins to be added to this component. Can also be just a single plugin instead of array.
Plugins provide custom functionality for a component. The only requirement for
a valid plugin is that it contain an init
method that accepts a reference of type Ext.Component. When a component
is created, if any plugins are available, the component will call the init method on each plugin, passing a
reference to itself. Each plugin can then call methods or respond to events on the component as needed to provide
its functionality.
Plugins can be added to component by either directly referencing the plugin instance:
plugins: [Ext.create('Ext.grid.plugin.CellEditing', {clicksToEdit: 1})],
By using config object with ptype:
plugins: {ptype: 'cellediting', clicksToEdit: 1},
Or with just a ptype:
plugins: ['cellediting', 'gridviewdragdrop'],
See Ext.enums.Plugin for list of all ptypes.
Available since: 2.3.0
One or more names of config properties that this component should publish to its ViewModel. Generally speaking, only properties defined in a class config block (including ancestor config blocks and mixins) are eligible for publishing to the viewModel. Some components override this and publish their most useful configs by default.
Note: We'll discuss publishing properties not found in the config block below.
Values determined to be invalid by component (often form fields and model validations) will not be published to the ViewModel.
This config uses the cfg-reference
to determine the name of the data
object to place in the ViewModel
. If reference
is not set then this config
is ignored.
By using this config and cfg-reference
you can bind configs between
components. For example:
...
items: [{
xtype: 'textfield',
reference: 'somefield', // component's name in the ViewModel
publishes: 'value' // value is not published by default
},{
...
},{
xtype: 'displayfield',
bind: 'You have entered "{somefield.value}"'
}]
...
Classes must provide this config as an Object:
Ext.define('App.foo.Bar', {
publishes: {
foo: true,
bar: true
}
});
This is required for the config system to properly merge values from derived classes.
For instances this value can be specified as a value as show above or an array or object as follows:
{
xtype: 'textfield',
reference: 'somefield',
publishes: [
'value',
'rawValue',
'dirty'
]
}
// This achieves the same result as the above array form.
{
xtype: 'textfield',
reference: 'somefield',
publishes: {
value: true,
rawValue: true,
dirty: true
}
}
In some cases, users may want to publish a property to the viewModel that is not found in a class config block. In these situations, you may utilize publishState if the property has a setter method. Let's use setFieldLabel as an example:
setFieldLabel: function(fieldLabel) {
this.callParent(arguments);
this.publishState('fieldLabel', fieldLabel);
}
With the above chunk of code, fieldLabel may now be published to the viewModel.
Defaults to:
null
Available since: 5.0.0
Specifies a name for this component inside its component hierarchy. This name must be unique within its view or its Ext.app.ViewController. See the documentation in Ext.container.Container for more information about references.
Note: Valid identifiers start with a letter or underscore and are followed by zero or more additional letters, underscores or digits. References are case sensitive.
Defaults to:
null
Defines the region inside Ext.layout.container.Border.
Possible values:
region: "center"
in every border layout.Defaults to:
undefined
Returns a region object that defines the area of this element.
A Region containing "top, left, bottom, right" properties.
The data used by renderTpl in addition to the following property values of the component:
See renderSelectors and cfg-childEls for usage examples.
An object containing properties specifying CSS selectors which identify child elements created by the render process.
After the Component's internal structure is rendered according to the renderTpl, this object is iterated through,
and the found Elements are added as properties to the Component using the renderSelector
property name.
For example, a Component which renders a title and description into its element:
Ext.create('Ext.Component', {
renderTo: Ext.getBody(),
renderTpl: [
'<h1 class="title">{title}</h1>',
'<p>{desc}</p>'
],
renderData: {
title: "Error",
desc: "Something went wrong"
},
renderSelectors: {
titleEl: 'h1.title',
descEl: 'p'
},
listeners: {
afterrender: function(cmp){
// After rendering the component will have a titleEl and descEl properties
cmp.titleEl.setStyle({color: "red"});
}
}
});
The use of renderSelectors
is deprecated (for performance reasons). The above
code should be refactored into something like this:
Ext.create('Ext.Component', {
renderTo: Ext.getBody(),
renderTpl: [
'<h1 class="title" id="{id}-titleEl" data-ref="titleEl">{title}</h1>',
'<p id="{id}-descEl" data-ref="descEl">{desc}</p>'
],
renderData: {
title: "Error",
desc: "Something went wrong"
},
childEls: [
'titleEl',
'descEl'
]
});
To use childEls
yet retain the use of selectors (which remains as expensive as
renderSelectors
):
Ext.create('Ext.Component', {
renderTo: Ext.getBody(),
renderTpl: [
'<h1 class="title">{title}</h1>',
'<p>{desc}</p>'
],
renderData: {
title: "Error",
desc: "Something went wrong"
},
childEls: {
titleEl: { selectNode: 'h1.title' },
descEl: { selectNode: 'p' }
}
});
Deprecated since version 5.0
Use cfg-childEls instead.
Specify the id
of the element, a DOM element or an existing Element that this component will be rendered into.
Notes:
Do not use this option if the Component is to be a child item of a Ext.container.Container. It is the responsibility of the Ext.container.Container's layout manager to render and manage its child items.
When using this config, a call to render()
is not required.
See also: method-render.
Available since: 2.3.0
An Ext.XTemplate used to create the internal structure inside this Component's encapsulating Element.
You do not normally need to specify this. For the base classes Ext.Component and
Ext.container.Container, this defaults to null
which means that they will be initially rendered
with no internal structure; they render their Element empty. The more specialized Ext JS and Sencha Touch
classes which use a more complex DOM structure, provide their own template definitions.
This is intended to allow the developer to create application-specific utility Components with customized internal structure.
Upon rendering, any created child elements may be automatically imported into object properties using the renderSelectors and cfg-childEls options.
Defaults to:
[ '<tpl if="renderScroller">', '<div class="{scrollerCls}" style="{%this.renderPadding(out, values)%}">', '</tpl>', '{%this.renderContent(out,values)%}', '<tpl if="renderScroller"></div></tpl>' ]
Specify as true
to apply a Ext.resizer.Resizer to this Component after rendering.
May also be specified as a config object to be passed to the constructor of Ext.resizer.Resizer
to override any defaults. By default the Component passes its minimum and maximum size, and uses
Ext.resizer.Resizer#dynamic: false
A valid Ext.resizer.Resizer handles config string. Only applies when resizable = true.
Defaults to:
'all'
A buffer to be applied if many state events are fired within a short period.
Defaults to:
100
Configuration options to make this Component scrollable. Acceptable values are:
true
to enable auto scrolling.false
(or null
) to disable scrolling - this is the default.x
or horizontal
to enable horizontal scrolling onlyy
or vertical
to enable vertical scrolling onlyAlso accepts a configuration object for a Ext.scroll.Scroller
if
if advanced configuration is needed.
The getter for this config returns the Ext.scroll.Scroller instance. You can use the Scroller API to read or manipulate the scroll position:
// scrolls the component to 5 on the x axis and 10 on the y axis
component.getScrollable().scrollTo(5, 10);
Defaults to:
null
If provided this creates a new Session
instance for this component. If this
is a Container
, this will then be inherited by all child components.
To create a new session you can specify true
:
Ext.create({
xtype: 'viewport',
session: true,
items: [{
...
}]
});
Alternatively, a config object can be provided:
Ext.create({
xtype: 'viewport',
session: {
...
},
items: [{
...
}]
});
Defaults to:
null
Sets the value of session
session : Boolean / Object / Ext.data.Session
Specifies whether the floating component should be given a shadow. Set to true to automatically create an Ext.Shadow, or a string indicating the shadow's display Ext.Shadow#mode. Set to false to disable the shadow.
Defaults to:
'sides'
true
to enable an iframe shim for this Component to keep
windowed objects from showing through.
The possible values for shrinkWrap are:
false
): Neither width nor height depend on content.true
): Both width and height depend on content (shrink wrap).In CSS terms, shrink-wrap width is analogous to an inline-block element as opposed to a block-level element.
The shrinkWrap config is a class-level config and should be used when defining a subclass. It is not intended to be set as a config on instances of a given component.
For non-Panel components, shrinkWrap is a descriptive config only. It should be set when defining your own custom class including the DOM elements used to construct the component. The shrinkWrap property does not itself apply styling on the component elements. Rather, it should describe the CSS styling you've applied to your custom component (refer to the numeric matrix above).
When a component is owned by a container the layout of that container will inspect the component's shrinkWrap property during layout. The layout then uses the content-wrapping policy described by shrinkWrap to correctly size and position the container's child items.
Defaults to:
2
The size of the splitter. This becomes the height for vertical splitters and width for horizontal splitters.
Defaults to:
5
Gets the current size of the component's underlying element.
contentSize : Boolean (optional)
true to get the width/size minus borders and padding
An object containing the element's size:
Sets the width and height of this Component. This method fires the resize event. This method can accept
either width and height as separate arguments, or you can pass a size object like {width:10, height:20}
.
width : Number/String/Object
The new width to set. This may be one of:
{width: widthValue, height: heightValue}
.undefined
to leave the width unchanged.height : Number/String
The new height to set (not required if a size object is passed as the first arg). This may be one of:
undefined
to leave the height unchanged.this
An array of events that, when fired, should trigger this object to
save its state. Defaults to none. stateEvents
may be any type
of event supported by this object, including browser or custom events
(e.g., ['click', 'customerchange']
).
See stateful
for an explanation of saving and
restoring object state.
A flag which causes the object to attempt to restore the state of internal properties from a saved state on startup. The object must have a stateId for state to be managed.
Auto-generated ids are not guaranteed to be stable across page loads and cannot be relied upon to save and restore the same state for a object.
For state saving to work, the state manager's provider must have been set to an implementation of Ext.state.Provider which overrides the set and get methods to save and recall name/value pairs. A built-in implementation, Ext.state.CookieProvider is available.
To set the state provider for the current page:
Ext.state.Manager.setProvider(new Ext.state.CookieProvider({ expires: new Date(new Date().getTime()+(10006060247)), //7 days from now }));
A stateful object attempts to save state when one of the events listed in the stateEvents configuration fires.
To save state, a stateful object first serializes its state by calling getState.
The Component base class implements getState to save its width and height within the state only if they were initially configured, and have changed from the configured value.
The Panel class saves its collapsed state in addition to that.
The Grid class saves its column state and store state (sorters and filters and grouper) in addition to its superclass state.
If there is more application state to be save, the developer must provide an implementation which first calls the superclass method to inherit the above behaviour, and then injects new properties into the returned object.
The value yielded by getState is passed to Ext.state.Manager#set which uses the configured Ext.state.Provider to save the object keyed by the stateId.
During construction, a stateful object attempts to restore its state by calling Ext.state.Manager#get passing the stateId
The resulting object is passed to applyState*. The default implementation of applyState simply copies properties into the object, but a developer may override this to support restoration of more complex application state.
You can perform extra processing on state save and restore by attaching handlers to the beforestaterestore, staterestore, beforestatesave and statesave events.
Defaults to:
false
The unique id for this object to use for state management purposes.
See stateful for an explanation of saving and restoring state.
Gets the state id for this object.
The 'stateId' or the implicit 'id' specified by component configuration.
A custom style specification to be applied to this component's Element. Should be a valid argument to Ext.dom.Element#applyStyles.
new Ext.panel.Panel({
title: 'Some Title',
renderTo: Ext.getBody(),
width: 400, height: 300,
layout: 'form',
items: [{
xtype: 'textarea',
style: {
width: '95%',
marginBottom: '10px'
}
},
new Ext.button.Button({
text: 'Send',
minWidth: '100',
style: {
marginBottom: '10px'
}
})
]
});
Available since: 1.1.0
Sets the style for this Component's primary element.
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.
this
DOM tabIndex attribute for this Focusable
Return the actual tabIndex for this Focusable.
tabIndex attribute value
Set the tabIndex property for this Focusable. If the focusEl is avalable, set tabIndex attribute on it, too.
newTabIndex : Number
new tabIndex to set
True to automatically call toFront when the method-show method is called on an already visible, floating component.
Defaults to:
true
An Ext.Template, Ext.XTemplate or an array of strings to form an Ext.XTemplate. Used in
conjunction with the data
and tplWriteMode
configurations.
Available since: 3.4.0
The Ext.(X)Template method to use when updating the content area of the Component.
See Ext.XTemplate#overwrite
for information on default mode.
Defaults to:
'overwrite'
Available since: 3.4.0
Any configuration options to be passed to the underlying Ext.resizer.SplitterTracker.
Defaults to:
null
This object holds a map of config
properties that will update their binding
as they are modified. For example, value
is a key added by form fields. The
form of this config is the same as publishes
.
This config is defined so that updaters are not created and added for all bound properties since most cannot be modified by the end-user and hence are not appropriate for two-way binding.
Defaults to:
null
A UI style for a component.
Defaults to:
'default'
An array of of classNames
which are currently applied to this component.
Defaults to:
[]
The ViewModel
is a data provider for this component and its children. The
data contained in the ViewModel
is typically used by adding bind
configs
to the components that want present or edit this data.
When set, the ViewModel
is created and links to any inherited viewModel
instance from an ancestor container as the "parent". The ViewModel
hierarchy,
once established, only supports creation or destruction of children. The
parent of a ViewModel
cannot be changed on the fly.
If this is a root-level ViewModel
, the data model connection is made to this
component's associated Ext.data.Session
. This is
determined by calling getInheritedSession
.
Defaults to:
null
Sets the value of viewModel
viewModel : String / Object / Ext.app.ViewModel
A value to control how Components are laid out in a Ext.layout.container.Border layout or as docked items.
In a Border layout, this can control how the regions (not the center) region lay out if the west or east take full height or if the north or south region take full width. Also look at the Ext.layout.container.Border#regionWeights on the Border layout. An example to show how you can take control of this is:
Ext.create('Ext.container.Viewport', {
layout : 'border',
defaultType : 'panel',
items : [
{
region : 'north',
title : 'North',
height : 100
},
{
region : 'south',
title : 'South',
height : 100,
weight : -25
},
{
region : 'west',
title : 'West',
width : 200,
weight : 15
},
{
region : 'east',
title : 'East',
width : 200
},
{
region : 'center',
title : 'center'
}
]
});
If docked items, the weight will order how the items are laid out. Here is an example to put a Ext.toolbar.Toolbar above a Ext.panel.Panel's header:
Ext.create('Ext.panel.Panel', {
renderTo : document.body,
width : 300,
height : 300,
title : 'Panel',
html : 'Panel Body',
dockedItems : [
{
xtype : 'toolbar',
items : [
{
text : 'Save'
}
]
},
{
xtype : 'toolbar',
weight : -10,
items : [
{
text : 'Remove'
}
]
}
]
});
Defaults to:
null
The width of this component. A numeric value will be interpreted as the number of pixels; a string value will be treated as a CSS value with units.
Sets the width of the component. This method fires the resize event.
width : Number
The new width to set. This may be one of:
undefined
to leave the width unchanged.null
to clear the width.this
Note: Only applies to Ext.Component derived classes when used as a config in Ext.define.
This property provides a shorter alternative to creating objects than using a full
class name. Using xtype
is the most common way to define component instances,
especially in a container. For example, the items in a form containing text fields
could be created explicitly like so:
items: [
Ext.create('Ext.form.field.Text', {
fieldLabel: 'Foo'
}),
Ext.create('Ext.form.field.Text', {
fieldLabel: 'Bar'
}),
Ext.create('Ext.form.field.Number', {
fieldLabel: 'Num'
})
]
But by using xtype
, the above becomes:
items: [
{
xtype: 'textfield',
fieldLabel: 'Foo'
},
{
xtype: 'textfield',
fieldLabel: 'Bar'
},
{
xtype: 'numberfield',
fieldLabel: 'Num'
}
]
When the xtype
is common to many items, Ext.container.Container#defaultType
is another way to specify the xtype
for all items that don't have an explicit xtype
:
defaultType: 'textfield',
items: [
{ fieldLabel: 'Foo' },
{ fieldLabel: 'Bar' },
{ fieldLabel: 'Num', xtype: 'numberfield' }
]
Each member of the items
array is now just a "configuration object". These objects
are used to create and configure component instances. A configuration object can be
manually used to instantiate a component using Ext#widget:
var text1 = Ext.create('Ext.form.field.Text', {
fieldLabel: 'Foo'
});
// or alternatively:
var text1 = Ext.widget({
xtype: 'textfield',
fieldLabel: 'Foo'
});
This conversion of configuration objects into instantiated components is done when
a container is created as part of its {Ext.container.AbstractContainer#initComponent}
process. As part of the same process, the items
array is converted from its raw
array form into a Ext.util.MixedCollection instance.
You can define your own xtype
on a custom Ext.Component by specifying
the xtype
property in Ext#define. For example:
Ext.define('MyApp.PressMeButton', {
extend: 'Ext.button.Button',
xtype: 'pressmebutton',
text: 'Press Me'
});
Care should be taken when naming an xtype
in a custom component because there is
a single, shared scope for all xtypes. Third part components should consider using
a prefix to avoid collisions.
Ext.define('Foo.form.CoolButton', {
extend: 'Ext.button.Button',
xtype: 'ux-coolbutton',
text: 'Cool!'
});
See Ext.enums.Widget for list of all available xtypes.
Available since: 2.3.0
The value true
causes config
values to be stored on instances using a
property name prefixed with an underscore ("_") character. A value of false
stores config
values as properties using their exact name (no prefix).
Defaults to:
true
Available since: 5.0.0
The value true
instructs the initConfig
method to only honor values for
properties declared in the config
block of a class. When false
, properties
that are not declared in a config
block will be placed on the instance.
Defaults to:
true
Available since: 5.0.0
Setting this property to true
causes the isLayoutRoot method to return
true
and stop the search for the top-most component for a layout.
Defaults to:
false
This property holds one of the following values during the render process:
beforeRender
process and is about to
call onRender
. This is when rendering
is set to true
.onRender
. This is when rendered
is set
to true
.Defaults to:
0
Available since: 5.0.0
true
indicates an id
was auto-generated rather than provided by configuration.
Defaults to:
false
Template method to do any pre-blur processing.
Defaults to:
Ext.emptyFn
e : Ext.event.Event
The event object
Template method to do any pre-focus processing.
Defaults to:
Ext.emptyFn
e : Ext.event.Event
The event object
The number of component layout calls made on this object.
Defaults to:
0
The name of the padding property that is used by the layout to manage padding. See managePadding
Defaults to:
'padding'
By default this method does nothing but return the position spec passed to it. In rtl mode it is overridden to convert "l" to "r" and vice versa when required.
Defaults to:
Ext.identityFn
This property is used to determine the property of a bind
config that is just
the value. For example, if defaultBindProperty="value"
, then this shorthand
bind
config:
bind: '{name}'
Is equivalent to this object form:
bind: {
value: '{name}'
}
The defaultBindProperty
is set to "value" for form fields and to "store" for
grids and trees.
Defaults to:
null
Initial suspended call count. Incremented when suspendEvents is called, decremented when resumeEvents is called.
Defaults to:
0
Only present for floating Components which were inserted as child items of Containers.
There are other similar relationships such as the Ext.button.Button which activates a menu, or the Ext.menu.Item which activated a submenu, or the Ext.grid.column.Column which activated the column menu.
These differences are abstracted away by the up method.
Floating Components that are programmatically rendered will not have a floatParent
property.
See floating and zIndexManager
true
for interactive Components, false
for static Components.
For Containers, this property reflects interactiveness of the
Container itself, not its children. See isFocusable.
Note: Plain components are static, so not focusable.
Defaults to:
false
Indicates the width of any framing elements which were added within the encapsulating
element to provide graphical, rounded borders. See the frame config. This
property is null
if the component is not framed.
This is an object containing the frame width in pixels for all four sides of the Component containing the following properties:
Defaults to:
null
top : Number
The width of the top framing element in pixels.
Defaults to: 0
right : Number
The width of the right framing element in pixels.
Defaults to: 0
bottom : Number
The width of the bottom framing element in pixels.
Defaults to: 0
left : Number
The width of the left framing element in pixels.
Defaults to: 0
width : Number
The total width of the left and right framing elements in pixels.
Defaults to: 0
height : Number
The total height of the top and right bottom elements in pixels.
Defaults to: 0
This object holds a key for any event that has a listener. The listener may be set directly on the instance, or on its class or a super class (via observe) or on the Ext.app.EventBus. The values of this object are truthy (a non-zero number) and falsy (0 or undefined). They do not represent an exact count of listeners. The value for an event is truthy if the event must be fired and is falsy if there is no need to fire the event.
The intended use of this property is to avoid the expense of fireEvent calls when there are no listeners. This can be particularly helpful when one would otherwise have to call fireEvent hundreds or thousands of times. It is used like this:
if (this.hasListeners.foo) {
this.fireEvent('foo', this, arg1);
}
Template method to do any Focusable related initialization that does not involve event listeners creation.
Defaults to:
Ext.emptyFn
The config object passed to the constructor during Component creation.
Defaults to:
config
true
in this class to identify an object as an instantiated Component, or subclass thereof.
Defaults to:
true
This property is set to true
during the call to initConfig
.
Defaults to:
false
Available since: 5.0.0
This property is set to true
if this instance is the first of its class.
Defaults to:
false
Available since: 5.0.0
This value is true
and is used to identify plain objects from instances of
a defined class.
Defaults to:
true
true
in this class to identify an object as an instantiated Observable, or subclass thereof.
Defaults to:
true
This is an internal flag that you use when creating custom components. By default this is set to true
which means
that every component gets a mask when it's disabled. Components like FieldContainer, FieldSet, Field, Button, Tab
override this property to false
since they want to implement custom disable logic.
Defaults to:
true
Orientation of this Splitter. 'vertical'
when used in an hbox layout, 'horizontal'
when used in a vbox layout.
This Component's owner Ext.container.Container (is set automatically when this Component is added to a Container).
Important. This is not a universal upwards navigation pointer. It indicates the Container which owns and manages this Component if any. There are other similar relationships such as the Ext.button.Button which activates a menu, or the Ext.menu.Item which activated a submenu, or the Ext.grid.column.Column which activated the column menu.
These differences are abstracted away by the up method.
Note: to access items within the Container see itemId.
Available since: 2.3.0
Template method to do any post-blur processing.
Defaults to:
Ext.emptyFn
e : Ext.event.Event
The event object
Template method to do any post-focus processing.
Defaults to:
Ext.emptyFn
e : Ext.event.Event
The event object
Indicates whether or not the component has been rendered.
Defaults to:
false
Available since: 1.1.0
An object property which provides unified information as to which dimensions are scrollable based upon the scrollable settings (And for views of trees and grids, the owning panel's scroll setting).
Note that if you set overflow styles using the style config or bodyStyle config, this object does not include that information. Use scrollable if you need to access these flags.
This object has the following properties:
Defaults to:
{ auto: { // x:auto, y:auto auto: { overflowX: 'auto', overflowY: 'auto', x: true, y: true, both: true }, // x:auto, y:false 'false': { overflowX: 'auto', overflowY: 'hidden', x: true, y: false, both: false }, // x:auto, y:scroll scroll: { overflowX: 'auto', overflowY: 'scroll', x: true, y: true, both: true } }, 'false': { // x:false, y:auto auto: { overflowX: 'hidden', overflowY: 'auto', x: false, y: true, both: false }, // x:false, y:false 'false': { overflowX: 'hidden', overflowY: 'hidden', x: false, y: false, both: false }, // x:false, y:scroll scroll: { overflowX: 'hidden', overflowY: 'scroll', x: false, y: true, both: false } }, scroll: { // x:scroll, y:auto auto: { overflowX: 'scroll', overflowY: 'auto', x: true, y: true, both: true }, // x:scroll, y:false 'false': { overflowX: 'scroll', overflowY: 'hidden', x: true, y: false, both: false }, // x:scroll, y:scroll scroll: { overflowX: 'scroll', overflowY: 'scroll', x: true, y: true, both: true } }, none: { overflowX: '', overflowY: '', x: false, y: false, both: false } }
x : Boolean
true
if this Component is scrollable
horizontally - style setting may be 'auto'
or 'scroll'
.
y : Boolean
true
if this Component is scrollable
vertically - style setting may be 'auto'
or 'scroll'
.
both : Boolean
true
if this Component is scrollable both
horizontally and vertically.
overflowX : String
The overflow-x
style setting, 'auto'
or 'scroll'
or ''
.
overflowY : String
The overflow-y
style setting, 'auto'
or 'scroll'
or ''
.
Get the reference to the current class from which this object was instantiated. Unlike Ext.Base#statics,
this.self
is scope-dependent and it's meant to be used for dynamic inheritance. See Ext.Base#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'
Defaults to:
Base
This property is true
if the component was created internally by the framework
and is not explicitly user-defined. This is set for such things as Splitter
instances managed by border
and box
layouts.
Defaults to:
false
Regular expression used for validating reference
values.
Defaults to:
/^[a-z_][a-z0-9_]*$/i
Only present for floating Components after they have been rendered.
A reference to the ZIndexManager which is managing this Component's z-index.
The Ext.ZIndexManager maintains a stack of floating Component z-indices, and also provides a single modal mask which is insert just beneath the topmost visible modal floating Component.
Floating Components may be brought to the front or sent to the back of the z-index stack.
This defaults to the global Ext.WindowManager for floating Components that are programatically rendered.
For floating Components which are added to a Container, the ZIndexManager is acquired from the first ancestor Container found which is floating. If no floating ancestor is found, the global Ext.WindowManager is used.
See Ext.Component#floating and zIndexParent
Only present for Ext.Component#floating Components which were inserted as child items of Containers, and which have a floating Container in their containment ancestry.
For Ext.Component#floating Components which are child items of a Container, the zIndexParent will be a floating ancestor Container which is responsible for the base z-index value of all its floating descendants. It provides a Ext.ZIndexManager which provides z-indexing services for all its descendant floating Components.
Floating Components that are programmatically rendered will not have a zIndexParent
property.
For example, the dropdown Ext.view.BoundList of a ComboBox which is in a Window will have the
Window as its zIndexParent
, and will always show above that Window, wherever the Window is placed in the z-index stack.
See Ext.Component#floating and zIndexManager
Adds declarative listeners as nested arrays of listener objects.
listeners : Array
true
if any listeners were added
Appends an after-event handler.
Same as addListener with order
set to 'after'
.
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.
Deprecated since version 5.1
Use addListener with the `priority` option instead.
Appends a before-event handler. Returning false
from the handler will stop the event.
Same as addListener with order
set to 'before'
.
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.
Deprecated since version 5.1
Use addListener with the `priority` option instead.
Ensures that the given property (if it is a Config System config) has a proper "updater" method on this instance to sync changes to the config.
Available since: 5.0.0
property : String
The name of the config property.
Adds a CSS class to the top level element representing this component.
Available since: 2.3.0
cls : String/String[]
The CSS class name to add.
Returns the Component to allow method chaining.
Deprecated since version 4.1
Use addCls instead.
Adds a CSS class to the top level element representing this component.
cls : String/String[]
The CSS class name to add.
Returns the Component to allow method chaining.
Adds a cls
to the uiCls
array, which will also call addUIClsToElement and adds to all elements of this
component.
classes : String/String[]
A string or an array of strings to add to the uiCls
.
skip : Boolean (optional)
true
to skip adding it to the class and do it later (via the return).
This method applies a versioned, deprecation declaration to this class. This
is typically called by the deprecated
config.
deprecations : 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}
});
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.
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'
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();
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.
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.
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();
Save a property to the given state object if it is not its default or configured value.
state : Object
The state object.
propName : String
The name of the property on this object to save.
value : String (optional)
The value of the state property (defaults to this[propName]
).
The state object or a new object if state was null
and the property
was saved.
Add events that will trigger the state to be saved. If the first argument is an array, each element of that array is the name of a state event. Otherwise, each argument passed to this method is the name of a state event.
events : String/String[]
The event name or an array of event names.
Method which adds a specified UI + uiCls
to the components element. Can be overridden
to add the UI to more than just the component's element.
uiCls : String
The UI class to add to the element.
Called after the mixin is applied. We need to see if childEls
were used by
the targetClass
and apply them to the config.
targetClass : Ext.Class
Called by the layout system after the Component has been laid out.
This method is not called on components that use liquidLayout, such as Ext.button.Button and Ext.form.field.Base.
width : Number
The width that was set
height : Number
The height that was set
oldWidth : Number/undefined
The old width, or undefined
if this was the initial layout.
oldHeight : Number/undefined
The old height, or undefined
if this was the initial layout.
This is a template method. a hook into the functionality of this class. Feel free to override it in child classes.
Invoked after the Component has been hidden.
Gets passed the same callback
and scope
parameters that #onHide received.
callback : Function (optional)
scope : Object (optional)
This is a template method. a hook into the functionality of this class. Feel free to override it in child classes.
Allows addition of behavior after rendering is complete. At this stage the Component's Element will have been styled according to the configuration, will have had any configured CSS class names added, and will be in the configured visibility and the configured enable state.
This is a template method. a hook into the functionality of this class. Feel free to override it in child classes.
Template method called after a Component has been positioned.
x : Number
y : Number
This is a template method. a hook into the functionality of this class. Feel free to override it in child classes.
Invoked after the Component is shown (after #onShow is called).
Gets passed the same parameters as #show.
animateTarget : String/Ext.dom.Element (optional)
callback : Function (optional)
scope : Object (optional)
This is a template method. a hook into the functionality of this class. Feel free to override it in child classes.
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:
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]);
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
this
Performs custom animation on this object.
This method is applicable to both the Ext.Component class and the Ext.draw.sprite.Sprite class. It performs animated transitions of certain properties of this object over a specified timeline.
When animating a Component, the following properties may be specified in from
, to
, and keyframe
objects:
x
- The Component's page X position in pixels.
y
- The Component's page Y position in pixels
left
- The Component's left
value in pixels.
top
- The Component's top
value in pixels.
width
- The Component's width
value in pixels.
height
- The Component's height
value in pixels.
dynamic
- Specify as true to update the Component's layout (if it is a Container) at every frame of the animation.
Use sparingly as laying out on every intermediate size change is an expensive operation.
For example, to animate a Window to a new size, ensuring that its internal layout and any shadow is correct:
myWindow = Ext.create('Ext.window.Window', {
title: 'Test Component animation',
width: 500,
height: 300,
layout: {
type: 'hbox',
align: 'stretch'
},
items: [{
title: 'Left: 33%',
margin: '5 0 5 5',
flex: 1
}, {
title: 'Left: 66%',
margin: '5 5 5 5',
flex: 2
}]
});
myWindow.show();
myWindow.header.el.on('click', function() {
myWindow.animate({
to: {
width: (myWindow.getWidth() == 500) ? 700 : 500,
height: (myWindow.getHeight() == 300) ? 400 : 300
}
});
});
For performance reasons, by default, the internal layout is only updated when the Window reaches its final "to"
size. If dynamic updating of the Window's child Components is required, then configure the animation with
dynamic: true
and the two child items will maintain their proportions during the animation.
config : Object
Configuration for Ext.fx.Anim. Note that the to config is required.
this
Available since: 5.0.0
binds : String/Object
currentBindings : Object
Sets references to elements inside the component. This applies renderSelectors as well as childEls.
Transforms a Session config to a proper instance.
Available since: 5.0.0
session : Object
Applies the state to the object. This should be overridden in subclasses to do more complex state operations. By default it applies the state properties onto the current object.
state : Object
The state
Transforms a ViewModel config to a proper instance.
Available since: 5.0.0
viewModel : String/Object/Ext.app.ViewModel
Sets references to elements inside the component.
el : Object
owner : Object
Occurs before componentLayout
is run. Returning false
from this method will prevent the componentLayout
from
being executed.
adjWidth : Number
The box-adjusted width that was set.
adjHeight : Number
The box-adjusted height that was set.
This is a template method. a hook into the functionality of this class. Feel free to override it in child classes.
Invoked before the Component is destroyed.
This is a template method. a hook into the functionality of this class. Feel free to override it in child classes.
Occurs before componentLayout is run. In previous releases, this method could
return false
to prevent its layout but that is not supported in Ext JS 4.1 or
higher. This method is simply a notification of the impending layout to give the
component a chance to adjust the DOM. Ideally, DOM reads should be avoided at this
time to reduce expensive document reflows.
This is a template method. a hook into the functionality of this class. Feel free to override it in child classes.
Template method called before a Component is positioned.
Ensures that the position is adjusted so that the Component is constrained if so configured.
x : Object
y : Object
animate : Object
Invoked before the Component is shown.
This is a template method. a hook into the functionality of this class. Feel free to override it in child classes.
Bubbles up the component/container hierarchy, calling the specified function with each component. The scope (this) of function call will be the scope provided or the current component. The arguments to the function will be the args provided or the current component. If the function returns false at any point, the bubble is stopped.
fn : Function
The function to call
scope : Object (optional)
The scope of the function. Defaults to current node.
args : Array (optional)
The args to call the function with. Defaults to passing the current component.
this
Ensures that all elements with "data-ref" attributes get loaded into the cache.
This really helps on IE8 where getElementById
is a search not a lookup. By
populating our cache with one search of the DOM we then have random access to
the elements as we do our childEls
wire up.
el : Object
Calculates x,y coordinates specified by the anchor position on the element, adding extraX and extraY values.
anchor : String (optional)
The specified anchor position. See alignTo for details on supported anchor positions.
Defaults to: 'tl'
extraX : Number (optional)
value to be added to the x coordinate
extraY : Number (optional)
value to be added to the y coordinate
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)
[x, y] An array containing the element's x and y coordinates
Calculates the new [x,y] position to move this Positionable into a constrain region.
By default, this Positionable is constrained to be within the container it was added to, or the element it was rendered to.
Priority is given to constraining the top and left within the constraint.
An alternative constraint may be passed.
constrainTo : String/HTMLElement/Ext.dom.Element/Ext.util.Region (optional)
The Element or Ext.util.Region into which this Component is to be constrained. Defaults to the element into which this Positionable was rendered, or this Component's {@link Ext.Component#constrainTo.
proposedPosition : Number[] (optional)
A proposed [X, Y]
position to test for validity
and to coerce into constraints instead of using this Positionable's current position.
local : Boolean (optional)
The proposedPosition is local (relative to floatParent if a floating Component)
proposedSize : Number[] (optional)
A proposed [width, height]
size to use when calculating
constraints instead of using this Positionable's current size.
If the element needs to be translated, the new [X, Y]
position within
constraints if possible, giving priority to keeping the top and left edge in the constrain region.
Otherwise, false
.
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.
args : Array/Arguments
The arguments, either an array or the arguments
object
from the current method, for example: this.callParent(arguments)
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', {
extend: 'Ext.some.Class',
method: function () {
console.log('Bad');
// ... logic but with a bug ...
this.callParent();
}
});
To patch the bug in Ext.some.DerivedClass.method
, the typical solution is to create an
override:
Ext.define('App.patches.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".
args : Array/Arguments
The arguments, either an array or the arguments
object
from the current method, for example: this.callSuper(arguments)
Returns the result of calling the superclass method
Clone the current component using the original config values passed into this instance by default.
overrides : Object
A new config containing any properties to override in the cloned version. An id property can be passed on this object, otherwise one will be generated to avoid duplicates.
clone The cloned copy of this component
ptype : String/Object
string or config object containing a ptype property.
Constructs a plugin according to the passed config object/ptype string.
Ensures that the constructed plugin always has a cmp
reference back to this component.
The setting up of this is done in PluginManager. The PluginManager ensures that a reference to this
component is passed to the constructor. It also ensures that the plugin's setCmp
method (if any) is called.
Returns an array of fully constructed plugin instances. This converts any configs into their appropriate instances.
It does not mutate the plugins array. It creates a new array.
Creates new Component.
config : Ext.dom.Element/String/Object
The configuration options may be specified as either:
Creates an event handling function which re-fires the event from this object as the passed event name.
newName : String
The name under which to re-fire the passed parameters.
beginEnd : Array (optional)
The caller can specify on which indices to slice.
Destroys the Component. This method must not be overridden.
To add extra functionality to destruction time in a subclass, implement the
template method or {@link #onDestroy. And do not forget to
callParent()
in your implementation.
Available since: 1.1.0
Disable the component.
Available since: 1.1.0
silent : Boolean (optional)
Passing true
will suppress the disable
event from being fired.
Defaults to: false
Called from the selected frame generation template to insert this Component's inner structure inside the framing structure.
When framing is used, a selected frame generation template is used as the primary template of the #getElConfig instead of the configured renderTpl. The renderTpl is invoked by this method which is injected into the framing template.
out : Object
values : Object
Handles autoRender. Floating Components may have an ownerCt. If they are asking to be constrained, constrain them within that ownerCt, and have their z-index managed locally. Floating Components are always rendered to document.body
This method needs to be called whenever you change something on this component that requires the Component's layout to be recalculated.
this
Deprecated since version 4.1
Use updateLayout instead.
Moves this floating Component into a constrain region.
By default, this Component is constrained to be within the container it was added to, or the element it was rendered to.
An alternative constraint may be passed.
constrainTo : String/HTMLElement/Ext.dom.Element/Ext.util.Region (optional)
The Element or Ext.util.Region into which this Component is to be constrained. Defaults to the element into which this floating Component was rendered.
Continue to fire event.
eventName : String
args : Array
bubbles : Boolean
Enable the component
Available since: 1.1.0
silent : Boolean (optional)
Passing true
will suppress the enable
event from being fired.
Defaults to: false
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');
}
}
});
eventNames : String/String[]
The event name to bubble, or an Array of event names.
Ensures that this component is attached to document.body
. If the component was
rendered to Ext#getDetachedBody, then it will be appended to document.body
.
Any configured position is also restored.
runLayout : Boolean (optional)
True to run the component's layout.
Defaults to: false
Finds an alternate Component to focus if this Component is disabled while focused, or focused while disabled, or otherwise unable to focus.
In both cases, focus must not be lost to document.body, but must move to an intuitively connectable Component, either a sibling, or uncle or nephew.
This is both for the convenience of keyboard users, and also for when focus is tracked within a Component tree such as for ComboBoxes and their dropdowns.
For example, a ComboBox with a PagingToolbar in is BoundList. If the "Next Page" button is hit, the LoadMask shows and focuses, the next page is the last page, so the "Next Page" button is disabled. When the LoadMask hides, it attempt to focus the last focused Component which is the disabled "Next Page" button. In this situation, focus should move to a sibling within the PagingToolbar.
A closely related focusable Component to which focus can move.
Find a container above this component at any level by a custom function. If the passed function returns true, the container will be returned.
See also the up method.
fn : Function
The custom function to call with the arguments (container, this component).
The first Container for which the custom function returns true
Find a container above this component at any level by xtype or class
See also the up method.
xtype : String/Ext.Class
The xtype string for a component, or the class of the component directly
The first Container which matches the given xtype or class
Retrieves plugin from this component's collection by its ptype
.
ptype : String
The Plugin's ptype as specified by the class's alias
configuration.
plugin instance.
This method visits the rendered component tree in a "top-down" order. That is, this code runs on a parent component before running on a child. This method calls the onRender method of each component.
containerIdx : Number
The index into the Container items of this Component.
Fires the specified event with the passed parameters and executes a function (action).
By default, the action function will be executed after any "before" event handlers
(as specified using the order
option of addListener
), but before any
other handlers are fired. This gives the "before" handlers an opportunity to
cancel the event by returning false
, and prevent the action function from being
called.
The action can also be configured to run after normal handlers, but before any "after"
handlers (as specified using the order
event option) by passing 'after'
as the order
parameter. This configuration gives any event handlers except
for "after" handlers the opportunity to cancel the event and prevent the action
function from being called.
eventName : String
The name of the event to fire.
args : Array
Arguments to pass to handlers and to the action function.
fn : Function
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.
options : Object (optional)
Event options for the action function. Accepts any
of the options of addListener
order : String (optional)
The order to call the action function relative
too the event handlers ('before'
or 'after'
). Note that this option is
simply used to sort the action function relative to the event handlers by "priority".
An order of 'before'
is equivalent to a priority of 99.5
, while an order of
'after'
is equivalent to a priority of -99.5
. See the priority
option
of addListener
for more details.
Defaults to: 'before'
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.
eventName : String
The name of the event to fire.
args : Object...
Variable number of parameters are passed to handlers.
returns false if any of the handlers return false otherwise it returns true.
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.
eventName : String
The name of the event to fire.
args : Object[]
An array of parameters which are passed to handlers.
returns false if any of the handlers return false otherwise it returns true.
This method fires an event on Ext.GlobalEvents
allowing interested parties to know
of certain critical events for this component. This is done globally because the
(few) listeners can immediately receive the event rather than bubbling the event
only to reach the top and have no listeners.
The main usage for these events is to do with floating components. For example, the load mask is a floating component. The component it is masking may be inside several containers. As such, they need to know when component is hidden, either directly, or via a parent container being hidden. To do this they subscribe to these events and filter out the appropriate container.
This functionality is contained in Component (as opposed to Container) because a Component can be the ownerCt for a floating component (loadmask), and the loadmask needs to know when its owner is shown/hidden so that its hidden state can be synchronized.
Available since: 4.2.0
eventName : String
The event name.
Try to focus this component.
If this component is disabled, a close relation will be targeted for focus instead to keep focus localized for keyboard users.
selectText : Mixed (optional)
If applicable, true
to also select all the text in this component, or an array consisting of start and end (defaults to start) position of selection.
delay : Boolean/Number (optional)
Delay the focus this number of milliseconds (true for 10 milliseconds).
callback : Function (optional)
Only needed if the delay
parameter is used. A function to call upon focus.
scope : Function (optional)
Only needed if the delay
parameter is used. The scope (this
reference) in which to execute the callback.
The focused Component. Usually this
Component. Some Containers may
delegate focus to a descendant Component (Ext.window.Windows can do this through their
defaultFocus config option. If this component is disabled, a closely
related component will be focused and that will be returned.
Updates this component's layout. If this update affects this components ownerCt,
that component's updateLayout
method will be called to perform the layout instead.
Otherwise, just this component (and its child items) will layout.
options : Object (optional)
An object with layout options.
Deprecated since version 4.1
Use updateLayout instead.
Returns the current animation if this object has any effects actively running or queued, else returns false.
Anim if element has active effects, else false
Gets the x,y coordinates to align this element with another element. See alignTo for more info on the supported position values.
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]
[x, y]
Gets the x,y coordinates of an element specified by the anchor position on the element.
el : Ext.dom.Element
The element
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)
[x, y] An array containing the element's x and y coordinates
Gets the x,y coordinates specified by the anchor position on the element.
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)
[x, y] An array containing the element's x and y coordinates
Returns the size of the element's borders and padding.
an object with the following numeric properties
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.
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.
An object in the format
Gets the bubbling parent for an Observable
The bubble parent. null is returned if no bubble target exists
Implements an upward event bubbling policy. By default a Component bubbles events up to its reference owner.
Component subclasses may implement a different bubbling strategy by overriding this method.
Returns a specified config property value. If the name parameter is not passed, all current configuration options will be returned as key value pairs.
name : String (optional)
The name of the config property to get.
peek : Boolean (optional)
true
to peek at the raw value without calling the getter.
Defaults to: false
The config property value.
Returns the content region of this element for purposes of constraining floating children. That is the region within the borders and scrollbars, but not within the padding.
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
.
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
If the element needs to be translated, an [X, Y]
vector by which this element must be translated. Otherwise, false
.
Retrieves the top level element representing this component.
Available since: 1.1.0
Returns the focus styling holder element associated with this Focusable. By default it is the same element as getFocusEl.
The focus styling element.
Returns the focus holder element associated with this Focusable. At the
level of the Focusable base, this function returns this.el
(or for Widgets,
this.element
).
Subclasses with embedded focusable elements (such as Window, Field and Button) should override this for use by focus method.
On render, reads an encoded style attribute, "filter" from the style of this Component's element. This information is memoized based upon the CSS class name of this Component's element. Because child Components are rendered as textual HTML as part of the topmost Container, a dummy div is inserted into the document to receive the document element's CSS class name, and therefore style attributes.
This method returns an object containing the inherited properties for this instance.
Available since: 5.0.0
inner : Boolean (optional)
Pass true
to return inheritedStateInner
instead
of the normal inheritedState
object. This is only needed internally and should
not be passed by user code.
Defaults to: false
The inheritedState
object containing inherited properties.
This method returns the value of a config property that may be inherited from some ancestor.
In some cases, a config may be explicitly set on a component with the intent of
only being presented to its children while that component should act upon the
inherited value (see referenceHolder
for example). In these cases the skipThis
parameter should be specified as true
.
Available since: 5.0.0
property : String
The name of the config property to return.
skipThis : Boolean (optional)
Pass true
if the property should be ignored if
found on this instance. In other words, true
means the property must be inherited
and not explicitly set on this instance.
Defaults to: false
The value of the requested property
.
Returns the initial configuration passed to constructor when instantiating this class.
name : String (optional)
Name of the config option to return.
The full config object or a single config value
when name
parameter specified.
This function takes the position argument passed to onRender and returns a DOM element that you can use in the insertBefore.
position : String/Number/Ext.dom.Element/HTMLElement
Index, element id or element you want to put this component before.
DOM element that you can use in the insertBefore
Returns the x coordinate of this element reletive to its offsetParent
.
The local x coordinate
Returns the x and y coordinates of this element relative to its offsetParent
.
The local XY position of the element
Returns the y coordinate of this element reletive to its offsetParent
.
The local y coordinate
Returns the element which is masked by the mask method, or into which the LoadMask is rendered into.
The default implementation uses the maskElement configuration to access the Component's child element by name. By default, maskElement
is null
which means that null
is returned from this method indicating that the mask needs to be rendered into the document because
component structure should not be contaminated by mask elements.
Some subclasses may override this method if they have knowledge about external structures where a mask could usefully be rendered.
For example a Ext.view.Table will request that its owning Ext.panel.Table be masked. The
GridPanel will have its own implementation of getMaskTarget
which will return the element dictated by its own maskElement
Panels use "el"
as their maskElement by default, but that could be overridden to be "body"
to leave toolbars and the header
mouse-accessible.
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.
offsetsTo : Ext.util.Positionable/HTMLElement/String
The Positionable, HTMLElement, or element id to get get the offsets from.
The XY page offsets (e.g. [100, -200]
)
Returns the CSS style object which will set the Component's scroll styles. This must be applied to the target element.
Retrieves a plugin from this component's collection by its pluginId
.
pluginId : String
plugin instance.
Gets the current XY position of the component's underlying element.
local : Boolean (optional)
If true the element's left and top are returned instead of page XY.
Defaults to: false
The XY position of the element (e.g., [100, 200])
Used by Ext.ComponentQuery, and the up method to find the owning Component in the linkage hierarchy.
By default this returns the Container which contains this Component.
This may be overridden by Component authors who implement ownership hierarchies which are not based upon ownerCt, such as BoundLists being owned by Fields or Menus being owned by Buttons.
Returns the "x" scroll position for this component. Only applicable for scrollable components
Returns the "y" scroll position for this component. Only applicable for scrollable components
Returns an object that describes how this component's width and height are managed. All of these objects are shared and should not be modified.
ownerCtSizeModel : Object
The size model for this component.
width : Ext.layout.SizeModel
The Ext.layout.SizeModel for the width.
height : Ext.layout.SizeModel
The Ext.layout.SizeModel for the height.
The supplied default state gathering method for the Component class.
This method returns dimension settings such as flex
, anchor
, width
and height
along with collapsed
state.
Subclasses which implement more complex state should call the superclass's implementation, and apply their state to the result if this basic state is to be saved.
Note that Component state will only be saved if the Component has a stateId and there as a StateProvider configured for the document.
Returns an offscreen div with the same class name as the element this is being rendered. This is because child item rendering takes place in a detached div which, being not part of the document, has no styling.
cls : Object
This is used to determine where to insert the 'html', 'contentEl' and 'items' in this component.
Partner method to getTdCls.
Returns the base type for the component. Defaults to return this.xtype
, but
All derived classes of Ext.form.field.Text can return the type 'textfield',
and all derived classes of Ext.button.Button can return the type 'button'
Returns the config object (with an xclass
property) for the splitter tracker. This
is overridden by Ext.resizer.BorderSplitter to create a
Ext.resizer.BorderSplitterTracker.
Returns the content region of this element. That is the region within the borders and padding.
A Region containing "top, left, bottom, right" member data.
Gets the current X position of the DOM element based on page coordinates.
The X position of the element
Gets the xtype for this component as registered with Ext.ComponentManager. For a list of all available xtypes, see the Ext.Component header. Example usage:
var t = new Ext.form.field.Text();
alert(t.getXType()); // alerts 'textfield'
The xtype
Returns this Component's xtype hierarchy as a slash-delimited string. For a list of all available xtypes, see the Ext.Component header.
If using your own subclasses, be aware that a Component must register its own xtype to participate in determination of inherited xtypes.
Example usage:
Available since: 2.3.0
The xtype hierarchy string
Gets the current position of the DOM element based on page coordinates.
The XY position of the element
Gets the current Y position of the DOM element based on page coordinates.
The Y position of the element
Returns the current animation if this object has any effects actively running or queued, else returns false.
Anim if element has active effects, else false
Deprecated since version 4.0
Replaced by getActiveAnimation
Checks if the specified CSS class exists on this element's DOM node.
className : String
The CSS class to check for.
true
if the class exists, else false
.
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.
eventName : String
The name of the event to check for
true
if the event is being listened for or bubbles, else false
Checks if there is currently a specified uiCls
.
cls : String
The cls
to check.
Hides this Component, setting it to invisible using the configured hideMode.
animateTarget : String/Ext.dom.Element/Ext.Component (optional)
only valid for cfg-floating Components
such as Ext.window.Windows or Ext.tip.ToolTips, or regular Components which have
been configured with floating: true
.. The target to which the Component should animate while hiding.
Defaults to: null
callback : Function (optional)
A callback function to call after the Component is hidden.
scope : Object (optional)
The scope (this
reference) in which the callback is executed.
Defaults to this Component.
this
This method triggers the lazy configs and must be called when it is time to
fully boot up. The configs that must be initialized are: bind
, publishes
,
session
, twoWayBindable
and viewModel
.
Available since: 5.0.0
The initComponent template method is an important initialization step for a Component. It is intended to be implemented by each subclass of Ext.Component to provide any needed constructor logic. The initComponent method of the class being created is called first, with each initComponent method up the hierarchy to Ext.Component being called thereafter. This makes it easy to implement and, if needed, override the constructor logic of the Component at any step in the hierarchy.
The initComponent method must contain a call to callParent in order to ensure that the parent class' initComponent method is also called.
All config options passed to the constructor are applied to this
before initComponent is called,
so you can simply access them with this.someOption
.
The following example demonstrates using a dynamic string for the text of a button at the time of instantiation of the class.
Ext.define('DynamicButtonText', {
extend: 'Ext.button.Button',
initComponent: function() {
this.text = new Date();
this.renderTo = Ext.getBody();
this.callParent();
}
});
Ext.onReady(function() {
Ext.create('DynamicButtonText');
});
Available since: 1.1.0
This is a template method. a hook into the functionality of this class. Feel free to override it in child classes.
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'
instanceConfig : Object
this
Sets up the focus listener on this Component's focusEl if it has one.
Form Components which must implicitly participate in tabbing order usually have a naturally
focusable element as their focusEl, and it is the DOM event of that
receiving focus which drives the Component's onFocus
handling, and the DOM event of it
being blurred which drives the onBlur
handling.
Template method to do any event listener initialization for a Focusable. This generally happens after the focusEl is available.
Called by getInherited
to initialize the inheritedState the first time it is
requested.
inheritedState : Object
Initializes padding by applying it to the target element, or if the layout manages padding ensures that the padding on the target element is "0".
targetEl : Object
Initialized the renderData to be used when rendering the renderTpl.
Object with keys and values that are going to be applied to the renderTpl
Initializes the renderTpl.
The renderTpl XTemplate instance.
Applies padding, margin, border, top, left, height, and width configs to the appropriate elements.
targetEl : Object
This method marks the current inherited state as invalid. The next time a call is
made to getInherited
the objects will be recreated and initialized.
Available since: 5.0.0
Tests whether this Component matches a Ext.ComponentQuery selector string.
selector : String
The selector string to test against.
true
if this Component matches the selector.
Determines whether this Component is an ancestor of the passed Component.
This will return true
if the passed Component is anywhere within the subtree
beneath this Component.
possibleDescendant : Ext.Component
The Component to test for presence within this Component's subtree.
Determines whether this component is the descendant of a passed component.
ancestor : Ext.Component
A Component which may contain this Component.
true
if the component is the descendant of the passed component, otherwise false
.
Method to determine whether this Component is currently disabled.
the disabled state of this Component.
Method to determine whether this Component is draggable.
the draggable state of this component.
Method to determine whether this Component is droppable.
the droppable state of this component.
Method to determine whether this Component is floating.
the floating state of this component.
Determine if this Focusable can receive focus at this time.
Note that Containers can be non-focusable themselves while delegating focus treatment to a child Component; see Ext.container.Container for more information.
deep : Boolean (optional)
Optionally determine if the container itself is focusable, or if container's focus is delegated to a child component and that child is focusable.
Defaults to: false
True if component is focusable, false if not.
Method to determine whether this Component is currently set to hidden.
the hidden state of this Component.
Checks if this component will be contained by the passed component as part of its
layout run. If true
, then the layout on this
can be skipped because it will be
encompassed when the layout for comp
runs. Typical cases where this may be be false
is when asking about floaters nested in containers.
comp : Ext.Component
The potential owner.
true
if this component is a layout child of comp
.
Determines whether this Component is the root of a layout. This returns true
if
this component can run its layout without assistance from or impact on its owner.
If this component cannot run its layout given these restrictions, false
is returned
and its owner will be considered as the next candidate for the layout root.
Setting the _isLayoutRoot property to true
causes this method to always
return true
. This may be useful when updating a layout of a Container which shrink
wraps content, and you know that it will not change size, and so can safely be the
topmost participant in the layout run.
Returns true
if layout is suspended for this component. This can come from direct
suspension of this component's layout activity (Ext.Container#suspendLayout) or if one
of this component's containers is suspended.
true
layout of this component is suspended.
Returns masked state for this Component.
deep : Boolean (optional)
True to look up this Component's parent masked state.
Defaults to: false
True if masked, false otherwise.
Checks if all events, or a specific event, is suspended.
event : String (optional)
The name of the specific event to check
true
if events are suspended
Returns true
if this component is visible.
Available since: 1.1.0
deep : Boolean (optional)
Pass true
to interrogate the visibility status of all parent Containers to
determine whether this Component is truly visible to the user.
Generally, to determine whether a Component is hidden, the no argument form is needed. For example when creating dynamically laid out UIs in a hidden Container before showing them.
Defaults to: false
true
if this component is visible, false
otherwise.
Tests whether or not this Component is of a specific xtype. This can test whether this Component is descended
from the xtype (default) or whether it is directly of the xtype specified (shallow = true
).
If using your own subclasses, be aware that a Component must register its own xtype to participate in determination of inherited xtypes.
For a list of all available xtypes, see the Ext.Component header.
Example usage:
Available since: 2.3.0
xtype : String
The xtype to check for this Component
shallow : Boolean (optional)
true
to check whether this Component is directly of the specified xtype, false
to
check whether this Component is descended from the xtype.
Defaults to: false
true
if this component descends from the specified xtype, false
otherwise.
Adds a "destroyable" object to an internal list of objects that will be destroyed
when this instance is destroyed (via destroy
).
name : String
value : Object
The value
passed.
Gets the controller that controls this view. May be a controller that belongs to a view higher in the hierarchy.
Available since: 5.0.1
skipThis : Boolean (optional)
true
to not consider the controller directly attached
to this view (if it exists).
Defaults to: false
The controller. null
if no controller is found.
Gets the Controller or Component that is used as the reference holder for this view.
Available since: 5.0.0
skipThis : Boolean (optional)
false
to return this as the reference holder if
this instance has set referenceHolder
. Unlike getInheritedConfig
this method
defaults to true
because it is possible that a reference
property set by the
owner of a component that is also a referenceHolder
itself. In this case, the
reference
connects not to this component but to the parent referenceHolder.
Defaults to: true
The reference holder.
Returns the Ext.data.Session
for this instance. This property may come
from this instance's session
or be inherited from this object's parent.
Available since: 5.0.0
skipThis : Boolean (optional)
Pass true
to ignore a session
configured on
this instance and only consider an inherited session.
Defaults to: false
Returns the Ext.app.ViewModel
for this instance. This property may come from this
this instance's viewModel
or be inherited from this object's parent.
Available since: 5.0.0
skipThis : Boolean (optional)
Pass true
to ignore a viewModel
configured on
this instance and only consider an inherited view model.
Defaults to: false
Returns an update
method for the given Config that will call publishState
to ensure two-way bindings (via bind
) as well as any publishes
are updated.
This method is cached on the cfg
instance for re-use.
Available since: 5.0.0
cfg : Ext.Config
The updater function.
Masks this component with a semi-opaque layer and makes the contents unavailable to clicks.
See unmask.
msg : String (optional)
A message to show in the center of the mask layer.
msgCls : String (optional)
A CSS class name to use on the message element in the center of the layer.
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.
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.
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 the element relative to its current position.
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
Shorthand for removeManagedListener. Removes listeners that were added by the mon method.
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.
Returns the next node in the Component tree in tree traversal order.
Note that this is not limited to siblings, and if invoked upon a node with no matching siblings, will walk the tree to attempt to find a match. Contrast with nextSibling.
selector : String (optional)
A Ext.ComponentQuery selector to filter the following nodes.
The next node (or the next node which matches the selector).
Returns null
if there is no matching node.
Returns the next sibling of this Component.
Optionally selects the next sibling which matches the passed Ext.ComponentQuery selector.
May also be referred to as next()
Note that this is limited to siblings, and if no siblings of the item match, null
is returned. Contrast with
nextNode
selector : String (optional)
A Ext.ComponentQuery selector to filter the following items.
The next sibling (or the next sibling which matches the selector).
Returns null
if there is no matching sibling.
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}
});
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.
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'
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();
Method to manage awareness of when components are added to their respective Container, firing an #added event. References are established at add time rather than at render time.
Allows addition of behavior when a Component is added to a
Container. At this stage, the Component is in the parent
Container's collection of child items. After calling the
superclass's onAdded
, the ownerCt
reference will be present,
and if configured with a ref, the refOwner
will be set.
Available since: 3.4.0
container : Ext.container.Container
Container which holds the component.
pos : Number
Position at which the component was added.
instanced : Boolean
false
if this component was instanced by the parent
container. true
if the instance already existed when it was passed to the container.
This is a template method. a hook into the functionality of this class. Feel free to override it in child classes.
Alias for addAfterListener. Appends an after-event handler.
Same as addListener with order
set to 'after'
.
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.
Deprecated since version 5.1
Use on instead.
Alias for addBeforeListener.
Appends a before-event handler. Returning false
from the handler will stop the event.
Same as addListener with order
set to 'before'
.
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.
Deprecated since version 5.1
Use on instead.
Invoked when this component has first achieved size. Occurs after the componentLayout has completed its initial run.
This method is not called on components that use liquidLayout, such as Ext.button.Button and Ext.form.field.Base.
width : Number
The width of this component
height : Number
The height of this component
This is a template method. a hook into the functionality of this class. Feel free to override it in child classes.
Allows addition of behavior to the destroy operation. After calling the superclass's onDestroy, the Component will be destroyed.
This is a template method. a hook into the functionality of this class. Feel free to override it in child classes.
Allows addition of behavior to the disable operation.
After calling the superclass's onDisable
, the Component will be disabled.
This is a template method. a hook into the functionality of this class. Feel free to override it in child classes.
Allows addition of behavior to the enable operation.
After calling the superclass's onEnable
, the Component will be enabled.
This is a template method. a hook into the functionality of this class. Feel free to override it in child classes.
Called when focus enters this Component's hierarchy
e : Ext.event.Event
This is a template method. a hook into the functionality of this class. Feel free to override it in child classes.
Called when focus exits from this Component's hierarchy
e : Ext.event.Event
This is a template method. a hook into the functionality of this class. Feel free to override it in child classes.
Allows addition of behavior to the hide operation. After calling the superclass's onHide, the Component will be hidden.
Gets passed the same parameters as #hide.
animateTarget : String/Ext.dom.Element/Ext.Component (optional)
callback : Function (optional)
scope : Object (optional)
This is a template method. a hook into the functionality of this class. Feel free to override it in child classes.
Called after the component is moved, this method is empty by default but can be implemented by any subclass that needs to perform custom logic after a move occurs.
x : Number
The new x position.
y : Number
The new y position.
This is a template method. a hook into the functionality of this class. Feel free to override it in child classes.
Method to manage awareness of when components are removed from their respective Container, firing a #removed event. References are properly cleaned up after removing a component from its owning container.
Allows addition of behavior when a Component is removed from
its parent Container. At this stage, the Component has been
removed from its parent Container's collection of child items,
but has not been destroyed (It will be destroyed if the parent
Container's autoDestroy
is true
, or if the remove call was
passed a truthy second parameter). After calling the
superclass's onRemoved
, the ownerCt
and the refOwner
will not
be present.
Available since: 3.4.0
destroying : Boolean
Will be passed as true
if the Container performing the remove operation will delete this
Component upon remove.
This is a template method. a hook into the functionality of this class. Feel free to override it in child classes.
Template method called when this Component's DOM structure is created.
At this point, this Component's (and all descendants') DOM structure exists but it has not been layed out (positioned and sized).
Subclasses which override this to gain access to the structure at render time should call the parent class's method before attempting to access any child elements of the Component.
parentNode : Ext.dom.Element
The parent Element in which this Component's encapsulating element is contained.
containerIdx : Number
The index within the parent Container's child collection of this Component.
This is a template method. a hook into the functionality of this class. Feel free to override it in child classes.
Called when the component is resized.
This method is not called on components that use liquidLayout, such as Ext.button.Button and Ext.form.field.Base.
width : Object
height : Object
oldWidth : Object
oldHeight : Object
This is a template method. a hook into the functionality of this class. Feel free to override it in child classes.
Invoked when a scroll operation is completed via this component's scroller.
x : Number
The current x position
y : Number
The current y position
This is a template method. a hook into the functionality of this class. Feel free to override it in child classes.
Invoked when this component is scrolled via its scroller.
x : Number
The current x position
y : Number
The current y position
This is a template method. a hook into the functionality of this class. Feel free to override it in child classes.
Invoked when a scroll is initiated on this component via its scroller.
x : Number
The current x position
y : Number
The current y position
This is a template method. a hook into the functionality of this class. Feel free to override it in child classes.
Allows addition of behavior to the show operation. After calling the superclass's onShow, the Component will be visible.
Override in subclasses where more complex behaviour is needed.
Gets passed the same parameters as #show.
animateTarget : String/Ext.dom.Element (optional)
callback : Function (optional)
scope : Object (optional)
This is a template method. a hook into the functionality of this class. Feel free to override it in child classes.
Invoked after the #afterShow method is complete.
Gets passed the same callback
and scope
parameters that #afterShow received.
callback : Function (optional)
scope : Object (optional)
This is a template method. a hook into the functionality of this class. Feel free to override it in child classes.
Returns true
if the passed element is within the container tree of this component.
For example if a menu's submenu contains an Ext.form.field.Date, that top level menu owns the elements of the date picker. Using this method, you can tell if an event took place within a certain component tree.
element : Object
Returns the previous node in the Component tree in tree traversal order.
Note that this is not limited to siblings, and if invoked upon a node with no matching siblings, will walk the tree in reverse order to attempt to find a match. Contrast with previousSibling.
selector : String (optional)
A Ext.ComponentQuery selector to filter the preceding nodes.
The previous node (or the previous node which matches the selector).
Returns null
if there is no matching node.
Returns the previous sibling of this Component.
Optionally selects the previous sibling which matches the passed Ext.ComponentQuery selector.
May also be referred to as prev()
Note that this is limited to siblings, and if no siblings of the item match, null
is returned. Contrast with
previousNode
selector : String (optional)
A Ext.ComponentQuery selector to filter the preceding items.
The previous sibling (or the previous sibling which matches the selector).
Returns null
if there is no matching sibling.
Publish this components state to the ViewModel
. If no arguments are given (or if
this is the first call), the entire state is published. This state is determined by
the publishes
property.
This method is called only by component authors.
Available since: 5.0.0
property : String (optional)
The name of the property to update.
value : Object (optional)
The value of property
. Only needed if property
is given.
Implementation which updates the scroll range of a touch scroller. Subclasses may change implementation.
Called by Component#doAutoRender
Register a Container configured floating: true
with this Component's Ext.ZIndexManager.
Components added in this way will not participate in any layout, but will be rendered upon first show in the way that Ext.window.Windows are.
cmp : 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).
origin : Object
The Observable whose events this object is to relay.
events : String[]
Array of event names to relay.
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'.
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();
Removes a before-event handler.
Same as removeListener with order
set to 'after'
.
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.
Deprecated since version 5.1
Use removeListener instead.
Removes a before-event handler.
Same as removeListener with order
set to 'before'
.
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.
Deprecated since version 5.1
Use removeListener instead.
Removes a CSS class from the top level element representing this component.
Available since: 2.3.0
cls : String/String[]
The CSS class name to remove.
Returns the Component to allow method chaining.
Deprecated since version 4.1
Use addCls instead.
Removes a CSS class from the top level element representing this component.
cls : String/String[]
The CSS class name to remove.
Returns the Component to allow method chaining.
Removes a cls
to the uiCls
array, which will also call removeUIClsFromElement and removes it from all
elements of this component.
cls : String/String[]
A string or an array of strings to remove to the uiCls
.
Removes an event handler.
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 {link #addListener 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'
});
Removes listeners that were added by the mon method.
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.
Remove a single managed listener item
isClear : Boolean
True if this is being called during a clear
managedListener : Object
The managed listener item See removeManagedListener for other args
Method which removes a specified UI + uiCls
from the components element. The cls
which is added to the element will be: this.baseCls + '-' + ui + uiCls
.
uiCls : String
The UI class to remove from the element.
Renders the Component into the passed HTML element.
If you are using a Ext.container.Container object to house this Component, then do not use the render method.
A Container's child Components are rendered by that Container's layout manager when the Container is first rendered.
If the Container is already rendered when a new child Component is added, you may need to call the Container's doLayout to refresh the view which causes any unrendered child Components to be rendered. This is required so that you can add multiple child components if needed while only refreshing the layout once.
When creating complex UIs, it is important to remember that sizing and positioning of child items is the responsibility of the Container's layout manager. If you expect child items to be sized in response to user interactions, you must configure the Container with a layout manager which creates and manages the type of layout you have in mind.
Omitting the Container's layout config means that a basic layout manager is used which does nothing but render child components sequentially into the Container. No sizing or positioning will be performed in this situation.
container : Ext.dom.Element/HTMLElement/String (optional)
The element this Component should be rendered into. If it is being created from existing markup, this should be omitted.
position : String/Number (optional)
The element ID or DOM node index within the container before which this component will be inserted (defaults to appending to the end of the container)
Gets the Controller or Component that is used as the event root for this view.
Available since: 5.0.0
defaultScope : Object (optional)
The default scope to return if none is found.
Defaults to: this
The default listener scope.
Returns the default listener scope for a "satellite" of this component. Used for resolving scope for observable objects that are not part of the normal Container/Component hierarchy (for example, plugins)
Available since: 5.1.1
satellite : Ext.mixin.Observable
defaultScope : Object (optional)
The listener scope
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.
eventName : String...
Multiple event names to resume.
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.
discardQueue : Boolean (optional)
true
to prevent any previously queued events from firing
while we were suspended. See suspendEvents.
Converts local coordinates into page-level coordinates
xy : Number[]
The local x and y coordinates
The translated coordinates
Returns focus to the cached previously focused Component or element.
Usually called by onHide.
Conditionally saves a single property from this object to the given state object. The idea is to only save state which has changed from the initial state so that current software settings do not override future software settings. Only those values that are user-changed state should be saved.
propName : String
The name of the property to save.
state : Object
The state object in to which to save the property.
stateName : String (optional)
The name to use for the property in state.
True if the property was saved, false if not.
Gathers additional named properties of the instance and adds their current values to the passed state object.
propNames : String/String[]
The name (or array of names) of the property to save.
state : Object
The state object in to which to save the property values.
state
Scrolls this Component by the passed delta values, optionally animating.
All of the following are equivalent:
comp.scrollBy(10, 10, true);
comp.scrollBy([10, 10], true);
comp.scrollBy({ x: 10, y: 10 }, true);
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.
Scrolls this component to the specified x
and y
coordinates. Only applicable
for scrollable components.
x : Number
y : Number
animate : Boolean/Object (optional)
true for the default animation or a standard Element animation config object
Ensures that all effects queued after sequenceFx is called on this object are run in sequence. This is the opposite of syncFx.
this
This method is called internally by Ext.ZIndexManager to signal that a floating Component has either been moved to the top of its zIndex stack, or pushed from the top of its zIndex stack.
If a Window is superceded by another Window, deactivating it hides its shadow.
This method also fires the activate or deactivate event depending on which action occurred.
active : Boolean (optional)
True to activate the Component, false to deactivate it.
Defaults to: false
doFocus : Boolean (optional)
When activating, set to true to focus the component; when deactivating, set to false to avoid returning focus to previous element.
Sets the element's box.
box : Object
The box to fill {x, y, width, height}
this
Sets a single/multiple configuration options.
name : String/Object
The name of the property to set, or a set of key value pairs to set.
value : Object (optional)
The value to set for the name parameter.
this
Sets the dock position of this component in its parent panel. Note that this only has effect if this item is part
of the dockedItems
collection of a parent that has a DockLayout (note that any Panel has a DockLayout by default)
dock : Object
The dock position.
this
Deprecated since version 5.0
Use setDock instead.
This method allows you to show or hide a LoadMask on top of this component.
The mask will be rendered into the element returned by getMaskTarget which for most Components is the Component's element. See getMaskTarget and maskElement.
Most Components will return null
indicating that their LoadMask cannot reside inside their element, but must
be rendered into the document body.
Ext.view.Table however will direct a LoadMask to be rendered into the owning Ext.panel.Table.
load : Boolean/Object/String
True to show the default LoadMask, a config object that will be passed to the LoadMask constructor, or a message String to show. False to hide the current LoadMask.
The LoadMask instance that has just been shown.
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.
x : Number
The x coordinate. A value of null
sets the left style to 'auto'.
this
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.
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'
this
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.
y : Number
The y coordinate. A value of null
sets the top style to 'auto'.
this
Set masked state for this Component.
isMasked : Boolean
True if masked, false otherwise.
Sets the overflow x/y on the content element of the component. The x/y overflow
values can be any valid CSS overflow (e.g., 'auto' or 'scroll'). By default, the
value is 'hidden'. Passing undefined
will preserve the current value.
overflowX : String
The overflow-x value.
overflowY : String
The overflow-y value.
this
Deprecated since version 5.0.0
Use setScrollable instead
Sets the page XY position of the component. To set the left and top instead, use setPosition. This method fires the event-move event.
x : Number/Number[]
The new x position or an array of [x,y]
.
y : Number (optional)
The new y position.
animate : Boolean/Object (optional)
True to animate the Component into its new position. You may also pass an animation configuration.
this
Sets the left and top of the component. To set the page XY position instead, use setPagePosition. This method fires the event-move event.
x : Number/Number[]/Object
The new left, an array of [x,y]
, or animation config object containing x
and y
properties.
y : Number (optional)
The new top.
animate : Boolean/Object (optional)
If true
, the Component is animated into its new position. You may also pass an
animation configuration.
this
Sets the "x" scroll position for this component. Only applicable for scrollable components
x : Number
animate : Boolean/Object (optional)
true for the default animation or a standard Element animation config object
Sets the "y" scroll position for this component. Only applicable for scrollable components
y : Number
animate : Boolean/Object (optional)
true for the default animation or a standard Element animation config object
Convenience function to hide or show this component by Boolean.
Available since: 1.1.0
visible : Boolean
true
to show, false
to hide.
this
Sets the X position of the DOM element based on page coordinates.
The : Number
X position
this
Sets the position of the DOM element in page coordinates.
pos : Number[]
Contains X & Y [x, y] values for new position (coordinates are page-based)
this
Sets the Y position of the DOM element based on page coordinates.
The : Number
Y position
this
Inject a reference to the function which applies the render template into the framing template. The framing template wraps the content.
frameTpl : Object
Shows this Component, rendering it first if autoRender or floating are true
.
After being shown, a floating Component (such as a Ext.window.Window), is activated it and brought to the front of its z-index stack.
animateTarget : String/Ext.dom.Element (optional)
only valid for floating Components such as Ext.window.Windows or Ext.tip.ToolTips, or regular Components which have been configured
with floating: true
. The target from which the Component should animate from while opening.
Defaults to: null
callback : Function (optional)
A callback function to call after the Component is displayed. Only necessary if animation was specified.
scope : Object (optional)
The scope (this
reference) in which the callback is executed.
Defaults to this Component.
this
Displays component at specific xy position. A floating component (like a menu) is positioned relative to its ownerCt if any. Useful for popping up a context menu:
listeners: {
itemcontextmenu: function(view, record, item, index, event, options) {
Ext.create('Ext.menu.Menu', {
width: 100,
height: 100,
margin: '0 0 10 0',
items: [{
text: 'regular item 1'
},{
text: 'regular item 2'
},{
text: 'regular item 3'
}]
}).showAt(event.getXY());
}
}
x : Number/Number[]
The new x position or array of [x,y]
.
y : Number (optional)
The new y position
animate : Boolean/Object (optional)
True to animate the Component into its new position. You may also pass an animation configuration.
this
Shows this component by the specified Ext.Component or Ext.dom.Element. Used when this component is floating.
component : Ext.Component/Ext.dom.Element
The Ext.Component or Ext.dom.Element to show the component by.
position : String (optional)
Alignment position as used by Ext.util.Positionable#getAlignToXY.
Defaults to defaultAlign
. See alignTo for possible values.
offsets : Number[] (optional)
Alignment offsets as used by Ext.util.Positionable#getAlignToXY. See alignTo for possible values.
this
Get the reference to the class from which this object was instantiated. Note that unlike Ext.Base#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
Stops any running effects and clears this object's internal effects queue if it contains any additional effects that haven't started yet.
The Element
Stops any running effects and clears this object's internal effects queue if it contains any additional effects that haven't started yet.
The Element
Deprecated since version 4.0
Replaced by stopAnimation
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.
eventName : String...
Multiple event names to suspend.
Suspends the firing of all events. (see resumeEvents)
queueSuspended : Boolean
true
to queue up suspended events to be fired
after the resumeEvents call instead of discarding all suspended events.
Ensures that all effects queued after syncFx is called on this object are run concurrently. This is the opposite of sequenceFx.
this
Sends this Component to the back of (lower z-index than) any other visible windows
this
Brings this floating Component to the front of any other visible, floating Components managed by the same Ext.ZIndexManager
If this Component is modal, inserts the modal mask just below this Component in the z-index stack.
preventFocus : Boolean (optional)
Specify true
to prevent the Component from being focused.
Defaults to: false
this
Translates the passed page coordinates into left/top css values for the element
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
An object with left and top properties. e.g. {left: (value), top: (value)}
Translates the passed page coordinates into x and y css values for the element
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
An object with x and y properties. e.g. {x: (value), y: (value)}
Shorthand for removeListener. Removes an event handler.
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 {link #addListener 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'
});
Alias for removeAfterListener. Removes a before-event handler.
Same as removeListener with order
set to 'after'
.
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.
Deprecated since version 5.1
Use un instead.
Alias for removeBeforeListener. Removes a before-event handler.
Same as removeListener with order
set to 'before'
.
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.
Deprecated since version 5.1
Use un instead.
Destroys a given set of linked
objects. This is only needed if
the linked object is being destroyed before this instance.
names : String[]
The names of the linked objects to destroy.
this
Navigates up the ownership hierarchy searching for an ancestor Container which matches any passed selector or component.
Important. There is not a universal upwards navigation pointer. There are several upwards relationships such as the Ext.button.Button which activates a menu, or the Ext.menu.Item which activated a submenu, or the Ext.grid.column.Column which activated the column menu.
These differences are abstracted away by this method.
Example:
var owningTabPanel = grid.up('tabpanel');
selector : String/Ext.Component (optional)
The selector component or actual component to test. If not passed the immediate owner/activator is returned.
limit : String/Number/Ext.Component (optional)
This may be a selector upon which to stop the upward scan, or a limit of the number of steps, or Component reference to stop on.
The matching ancestor Container (or undefined
if no match was found).
Update the content area of a component.
Available since: 3.4.0
htmlOrData : String/Object
If this component has been configured with a template via the tpl config then it will use this argument as data to populate the template. If this component was not configured with a template, the components content area will be updated via Ext.Element update.
loadScripts : Boolean (optional)
Only legitimate when using the html
configuration.
Defaults to: false
callback : Function (optional)
Only legitimate when using the html
configuration.
Callback to execute when scripts have finished loading.
Sets the current box measurements of the component's underlying element.
box : Object
An object in the format {x, y, width, height}
this
Updates the frame elements to match new framing. The current frameBody
is
preserved by transplanting it into the new frame. All other frame childEls
are destroyed and recreated if needed by the new frame. This method cannot
transition from framed to non-framed or vise-versa or between table and div
based framing.
Updates this component's layout. If this update affects this components ownerCt,
that component's updateLayout
method will be called to perform the layout instead.
Otherwise, just this component (and its child items) will layout.
Updates the session config.
Available since: 5.0.0
session : Ext.data.Session
Updates the viewModel config.
Available since: 5.0.0
viewModel : Ext.app.ViewModel
Adds new config properties to this class. This is called for classes when they are declared, then for any mixins that class may define and finally for any overrides defined that target the class.
config : Object
mixinClass : Ext.Class (optional)
The mixin class if the configs are from a mixin.
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();
members : Object
The members to add to this class.
isStatic : Boolean (optional)
Pass true
if the members are static.
Defaults to: false
privacy : Boolean (optional)
Pass true
if the members are private. This
only has meaning in debug mode and only for methods.
Defaults to: false
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() { ... };
});
members : Object
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 '$$$$$$$'
fromClass : Ext.Base
The class to borrow members from
members : Array/String
The names of the members to borrow
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.
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()
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 Ext.Configurator
for this class.
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'
className
Used internally by the mixins pre-processor
name : Object
mixinClass : Object
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"
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).
members : Object
The properties to add to this class. This should be specified as an object literal containing one or more properties.
this class
Fires after a Component has been visually activated.
Note This event is only fired if this Component is a child of a Ext.container.Container that uses Ext.layout.container.Card as it's layout or this Component is a floating Component.
this : Ext.Component
eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires after a Component had been added to a Container.
Available since: 3.4.0
this : Ext.Component
container : Ext.container.Container
Parent Container
pos : Number
position of Component
eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires after the component rendering is finished.
The afterrender
event is fired after this Component has been rendered, been post-processed by any
afterRender
method defined for the Component.
Available since: 3.4.0
this : Ext.Component
eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires before a Component has been visually activated. Returning false
from an event listener can prevent
the activate from occurring.
Note This event is only fired if this Component is a child of a Ext.container.Container that uses Ext.layout.container.Card as it's layout.
this : Ext.Component
eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires before a Component has been visually deactivated. Returning false
from an event listener can
prevent the deactivate from occurring.
Note This event is only fired if this Component is a child of a Ext.container.Container that uses Ext.layout.container.Card as it's layout.
this : Ext.Component
eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires before the component is method-destroyed. Return false
from an event handler to stop the
method-destroy.
Available since: 1.1.0
this : Ext.Component
eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires before the component is hidden when calling the hide method. Return false
from an event
handler to stop the hide.
Available since: 1.1.0
this : Ext.Component
eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires before the component is rendered. Return false
from an event handler to stop the
method-render.
Available since: 1.1.0
this : Ext.Component
eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires before the component is shown when calling the show method. Return false
from an event
handler to stop the show.
Available since: 1.1.0
this : Ext.Component
eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires before the state of the object is restored. Return false from an event handler to stop the restore.
this : Ext.state.Stateful
state : Object
The hash of state values returned from the StateProvider. If this
event is not vetoed, then the state object is passed to applyState
. By default,
that simply copies property values into this object. The method maybe overriden to
provide custom state restoration.
eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires before the state of the object is saved to the configured state provider. Return false to stop the save.
this : Ext.state.Stateful
state : Object
The hash of state values. This is determined by calling
getState()
on the object. This method must be provided by the
developer to return whatever representation of state is required, by default, Ext.state.Stateful
has a null implementation.
eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires when this Component loses focus.
this : Ext.Component
event : Ext.event.Event
The blur event.
eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires one time - after the component has been laid out for the first time at its initial size.
This event does not fire on components that use liquidLayout, such as Ext.button.Button and Ext.form.field.Base.
this : Ext.Component
width : Number
The initial width.
height : Number
The initial height.
eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires after a Component has been visually deactivated.
Note This event is only fired if this Component is a child of a Ext.container.Container that uses Ext.layout.container.Card as it's layout or this Component is a floating Component.
this : Ext.Component
eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires after the component is method-destroyed.
Available since: 1.1.0
this : Ext.Component
eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires after the component is disabled.
Available since: 1.1.0
this : Ext.Component
eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires after the component is enabled.
Available since: 1.1.0
this : Ext.Component
eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires when this Component receives focus.
this : Ext.Component
event : Ext.event.Event
The focus event.
eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires after the component is hidden. Fires after the component is hidden when calling the hide method.
Available since: 1.1.0
this : Ext.Component
eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires after the component is moved.
this : Ext.Component
x : Number
The new x position.
y : Number
The new y position.
eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires when a component is removed from an Ext.container.Container
Available since: 3.4.0
this : Ext.Component
ownerCt : Ext.container.Container
Container which holds the component
eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires after the component markup is rendered.
Available since: 1.1.0
this : Ext.Component
eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires after the component is resized. Note that this does not fire when the component is first laid out at its initial size. To hook that point in the life cycle, use the boxready event.
This event does not fire on components that use liquidLayout, such as Ext.button.Button and Ext.form.field.Base.
this : Ext.Component
width : Number
The new width that was set.
height : Number
The new height that was set.
oldWidth : Number
The previous width.
oldHeight : Number
The previous height.
eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires after the component is shown when calling the show method.
Available since: 1.1.0
this : Ext.Component
eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires after the state of the object is restored.
this : Ext.state.Stateful
state : Object
The hash of state values returned from the StateProvider. This is passed
to applyState
. By default, that simply copies property values into this
object. The method maybe overridden to provide custom state restoration.
eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires after the state of the object is saved to the configured state provider.
this : Ext.state.Stateful
state : Object
The hash of state values. This is determined by calling
getState()
on the object. This method must be provided by the
developer to return whatever representation of state is required, by default, Ext.state.Stateful
has a null implementation.
eOpts : Object
The options object passed to Ext.util.Observable.addListener.
The the type of cursor to display when the cursor is over the collapse tool
Defaults to:
pointer
The size of the collapse tool. This becomes the width of the collapse tool for horizontal splitters, and the height for vertical splitters.
Defaults to:
35px
The background color of scroll indicators when touch scrolling is enabled
Defaults to:
#000
The border-radius of scroll indicators when touch scrolling is enabled
Defaults to:
3px
The space between scroll indicators and the edge of their container
Defaults to:
2px
The opacity of scroll indicators when touch scrolling is enabled
Defaults to:
.5
The background color of scroll indicators when touch scrolling is enabled
Defaults to:
6px
The background-color of the active Splitter (the Splitter currently being dragged)
Defaults to:
#b4b4b4
The opacity of the collapse tool on the active Splitter (the Splitter currently being dragged)
Defaults to:
.3
The opacity of the active Splitter (the Splitter currently being dragged)
Defaults to:
.8
The color of the outline around the splitter when it is focused
Defaults to:
$base-color
The outline-offset of the splitter when it is focused
Defaults to:
-$splitter-focus-outline-width
The outline-style of the splitter when it is focused
Defaults to:
solid
The outline-width of the splitter when it is focused
Defaults to:
1px