Ext.Button
Hierarchy
Subclasses
Files
A simple class to display different styles of buttons.
Useful Properties
- ui (defines the style of the button)
Useful Methods
- handler (method to be called when the button is tapped)
Screenshot:

Example code:
// an array of buttons (using xtypes) to be included in the panel below
var buttons = [
{
text: 'Normal'
},
{
ui : 'round',
text: 'Round'
},
{
ui : 'small',
text: 'Small'
}
];
var panel = new Ext.Panel({
layout: {
type : 'vbox',
pack : 'center',
align: 'stretch'
},
defaults: {
layout: {
type: 'hbox'
},
flex: 1,
defaults: {
xtype: 'button',
cls : 'demobtn',
flex : 1
}
},
items: [
{
items: buttons // buttons array defined above
},
{
items: [
new Ext.Button({
ui : 'decline',
text: 'Drastic'
}),
{
ui : 'decline-round',
text: 'Round'
},
{
ui : 'decline-small',
text: 'Small'
}
]
},
{
items: [
{
ui : 'confirm',
text: 'Confirm'
},
{
ui : 'confirm-round',
text: 'Round'
},
{
ui : 'confirm-small',
text: 'Small'
}
]
}
]
});
Available since: 1.1.0
Config options
CSS class for badge Defaults to 'x-badge'
Defaults to: 'x-badge'
Available since: 1.1.0
The text to be used for a small badge on the button. Defaults to ''
Defaults to: ''
Available since: 1.1.0
Base CSS class Defaults to 'x-button'
Defaults to: 'x-button'
Available since: 1.1.0
Overrides: Ext.lib.Component.baseCls
Specifies the border 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'.
Available since: 1.1.0
Center the Component. Defaults to false.
Defaults to: false
Available since: 1.1.0
A CSS class string to apply to the button's main element.
A CSS class string to apply to the button's main element.
Available since: 1.1.0
Overrides: Ext.lib.Component.cls
CSS Class to be added to a components root level element to give distinction to it via styling.
CSS Class to be added to a components root level element to give distinction to it via styling.
Available since: 1.1.0
The sizing and positioning of the component Elements is the responsibility of
the Component's layout manager which creates and manages the type of layout specific to the component.
If the layout configuration is not explicitly specified for a general purpose compopnent the default layout manager will be used.
Available since: 1.1.0
Optional. Specify an existing HTML element, or the id of an existing HTML element to use as the content
for this component.
- Description :
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 render event is fired.The specified HTML element used will not participate in any
layoutscheme that the Component may use. It is just HTML. Layouts operate on childitems.Add either thex-hiddenor thex-hide-displayCSS class to prevent a brief flicker of the content before it is rendered to the panel.
Available since: 1.1.0
True to start disabled (defaults to false)
True to start disabled (defaults to false)
Available since: 1.1.0
Overrides: Ext.lib.Component.disabled
CSS class to add when the Component is disabled. Defaults to 'x-item-disabled'.
Defaults to: 'x-item-disabled'
Available since: 1.1.0
Allows the component to be dragged via the touch event.
Allows the component to be dragged via the touch event.
Available since: 1.1.0
Create the Component as a floating and use absolute positioning. Defaults to false.
Defaults to: false
Available since: 1.1.0
The class that is being added to this component when its floating. (defaults to x-floating)
Defaults to: 'x-floating'
Available since: 1.1.0
Force the component to take up 100% width and height available. Defaults to false. Setting this configuration immediately sets the monitorOrientation config to true. Setting this to true will render the component instantly.
Defaults to: false
Available since: 1.1.0
A function called when the button is clicked (can be used instead of click event). The handler is passed the following parameters:
b: ButtonThis Button.e: EventObjectThe click event.
Available since: 1.1.0
The height of this component in pixels.
The height of this component in pixels.
Available since: 1.1.0
True to automatically bind a tap listener to the mask that hides the window. Defaults to true. Note: if you set this property to false you have to programmaticaly hide the overlay.
Defaults to: true
Available since: 1.1.0
An HTML fragment, or a DomHelper specification to use as the layout element content (defaults to ''). The HTML content is added after the component is rendered, so the document will not contain this HTML at the time the render event is fired. This content is inserted into the body before any configured contentEl is appended.
Available since: 1.1.0
The path to an image to display in the button (the image will be set as the background-image CSS property of the button by default, so if you want a mixed icon/text button, set cls:'x-btn-text-icon')
Available since: 1.1.0
The alignment of the buttons icon if one has been defined. Valid options are 'top', 'right', 'bottom', 'left' (defaults to 'left').
Defaults to: 'left'
Available since: 1.1.0
A css class which sets a background image to be used as the icon for this button
A css class which sets a background image to be used as the icon for this button
Available since: 1.1.0
Whether or not to mask the icon with the iconMaskCls configuration. Defaults to false.
Defaults to: false
Available since: 1.1.0
CSS class to be added to the iconEl when the iconMask config is set to true. Defaults to 'x-icon-mask'
Defaults to: 'x-icon-mask'
Available since: 1.1.0
Set this to true to automatically relayout this component on orientation change. This property is set to true by default if a component is floating unless you specifically set this to false. Also note that you dont have to set this property to true if this component is a child of a fullscreen container, since fullscreen components are also laid out automatically on orientation change. Defaults to null
Available since: 1.1.0
(optional)
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 ExtJs Components
While some ExtJs 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 DataView's
click 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({
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'); }
}
}
});
Available since: 1.1.0
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'.
Available since: 1.1.0
The maximum value in pixels which this Component will set its height to.
Warning: This will override any size management applied by layout managers.
Available since: 1.1.0
The maximum value in pixels which this Component will set its width to.
Warning: This will override any size management applied by layout managers.
Available since: 1.1.0
The minimum value in pixels which this Component will set its height to.
Warning: This will override any size management applied by layout managers.
Available since: 1.1.0
The minimum value in pixels which this Component will set its width to.
Warning: This will override any size management applied by layout managers.
Available since: 1.1.0
True to make the Component modal and mask everything behind it when displayed, false to display it without restricting access to other UI elements (defaults to false).
Defaults to: false
Available since: 1.1.0
Monitor Orientation change
Defaults to: false
Available since: 1.1.0
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'.
Available since: 1.1.0
An object or array of objects that will provide custom functionality for this 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.
Available since: 1.1.0
CSS class when the button is in pressed state Defaults to 'x-button-pressed'
Defaults to: 'x-button-pressed'
Available since: 1.1.0
The amount of delay between the tapstart and the moment we add the pressedCls. Settings this to true defaults to 100ms
Defaults to: 0
Available since: 1.1.0
An object containing properties specifying DomQuery 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 rendered an image, and description into its element might use the following properties coded into its prototype:
renderTpl: '<img src="{imageUrl}" class="x-image-component-img"><div class="x-image-component-desc">{description}</div>',
renderSelectors: {
image: 'img.x-image-component-img',
descEl: 'div.x-image-component-desc'
}
After rendering, the Component would have a property image referencing its child img Element,
and a property descEl referencing the div Element which contains the description.
Available since: 1.1.0
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 Container. It is the responsibility of the Container's layout manager to render and manage its child items.When using this config, a call to render() is not required.
See render also.
Available since: 1.1.0
An 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, this defaults to null which means that they will be initially rendered
with no internal structure; they render their Element empty. The more specialized ExtJS and 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 option.
Available since: 1.1.0
The scope (this reference) in which the
handler and toggleHandler is
executed. Defaults to this Button.
Available since: 1.1.0
Configure the component to be scrollable. Acceptable values are:
- 'horizontal', 'vertical', 'both' to enabling scrolling for that direction.
- A Scroller configuration.
- false to explicitly disable scrolling.
Enabling scrolling immediately sets the monitorOrientation config to true (for Panel)
Available since: 1.1.0
The type of animation you want to use when this component is shown. If you set this this hide animation will automatically be the opposite.
Available since: 1.1.0
True to stop the event that fires when you click outside the floating component. Defalts to true.
Defaults to: true
Available since: 1.1.0
A custom style specification to be applied to this component's Element. Should be a valid argument to Ext.Element.applyStyles.
new Ext.Panel({
title: 'Some Title',
renderTo: Ext.getBody(),
width: 400, height: 300,
layout: 'form',
items: [{
xtype: 'textareafield',
style: {
width: '95%',
marginBottom: '10px'
}
},
new Ext.Button({
text: 'Send',
minWidth: '100',
style: {
marginBottom: '10px'
}
})
]
});
Available since: 1.1.0
The class that is added to the content target when you set styleHtmlContent to true. Defaults to 'x-html'
Defaults to: 'x-html'
Available since: 1.1.0
True to automatically style the html inside the content target of this component (body for panels). Defaults to false.
Defaults to: false
Available since: 1.1.0
The button text to be used as innerHTML (html tags are accepted)
The button text to be used as innerHTML (html tags are accepted)
Available since: 1.1.0
An data and
tplWriteMode configurations.
Available since: 1.1.0
The Ext.(X)Template method to use when
updating the content area of the Component. Defaults to 'overwrite'
(see Ext.XTemplate.overwrite).
Defaults to: 'overwrite'
Available since: 1.1.0
Determines the UI look and feel of the button. Valid options are 'normal', 'back', 'round', 'action', 'forward', 'decline', 'confirm' and 'small'. The 'round' and 'small' UIs can also be appended to the other options - for example 'confirm-small', 'action-round', 'forward-small' etc Defaults to 'normal'.
Defaults to: 'normal'
Available since: 1.1.0
Overrides: Ext.lib.Component.ui
The width of this component in pixels.
The width of this component in pixels.
Available since: 1.1.0
Properties
Read-only property indicating whether or not the component can be dragged
Defaults to: false
Available since: 1.1.0
Defaults to: /^(?:scope|delay|buffer|single|stopEvent|preventDefault|stopPropagation|normalized|args|delegate|element|vertical|horizontal)$/
Available since: 1.1.0
Read-only property indicating whether or not the component has been rendered.
Defaults to: false
Available since: 1.1.0
Methods
Create a new button
Available since: 1.1.0
Parameters
- config : Object
The config object
Returns
Overrides: Ext.Component.constructor
Adds a CSS class to the top level element representing this component.
Available since: 1.1.0
Returns
- Ext.Component
Returns the Component to allow method chaining.
Adds the specified events to the list of events which this Observable may fire.
Available since: 1.1.0
Parameters
- o : Object|String
Either an object with event names as properties with a value of
trueor the first event name string if multiple event names are being passed as separate parameters. - Optional : string
. Event name if multiple event names are being passed as separate parameters. Usage:
this.addEvents('storeloaded', 'storecleared');
Appends an event handler to this object.
Available since: 1.1.0
Parameters
- eventName : String
The name of the event to listen for. May also be an object who's property names are event names. See
- handler : Function
The method the event invokes.
- scope : Object (optional)
The scope (
thisreference) 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. properties. This may contain any of the following properties:
- scope : ObjectThe scope (
thisreference) in which the handler function is executed. If omitted, defaults to the object which fired the event. - delay : NumberThe number of milliseconds to delay the invocation of the handler after the event fires.
- single : BooleanTrue to add a handler to handle just the next firing of the event, and then remove itself.
- buffer : NumberCauses the handler to be scheduled to run in an Ext.util.DelayedTask delayed by the specified number of milliseconds. If the event fires again within that time, the original handler is not invoked, but the new handler is scheduled in its place.
- target : ObservableOnly call the handler if the event was fired on the target Observable, not if the event was bubbled up from a child Observable.
- element : StringThis option is only valid for listeners bound to Components. The name of a Component property which references an element to add a listener to.
This option is useful during Component construction to add DOM event listeners to elements of Components which will exist only after the Component is rendered. For example, to add a click listener to a Panel's body:
new Ext.Panel({ title: 'The title', listeners: { click: this.handlePanelClick, element: 'body' } });When added in this way, the options available are the options applicable to Ext.Element.addListener
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 events. For example:
.myGridPanel.on({ cellClick: this.onCellClick, mouseover: this.onMouseOver, mouseout: this.onMouseOut, scope: this // Important. Ensure "this" is correct during handler execution }); - scope : Object
Overrides: Ext.util.Observable.addListener
Adds listeners to any Observable object (or Element) which are automatically removed when this Component is destroyed.
Available since: 1.1.0
Parameters
- item : Observable|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
Optional. If the
enameparameter was an event name, this is the handler function. - scope : Object
Optional. If the
enameparameter was an event name, this is the scope (thisreference) in which the handler function is executed. - opt : Object
Optional. If the
enameparameter was an event name, this is the addListener options.
Template method that can be overriden to perform logic after the panel has layed out itself e.g. Resized the body and positioned all docked items.
Available since: 1.1.0
Overrides: Ext.lib.Component.afterComponentLayout
Available since: 1.1.0
Parameters
- alignTo : Object
- allowSides : Object
- offset : Object
Sets references to elements inside the component. E.g body -> x-panel-body
Available since: 1.1.0
Removes all listeners for this object including the managed listeners
Available since: 1.1.0
Removes all managed listeners for this object.
Available since: 1.1.0
If autoEvent is set, this creates a handler function that automatically fires that configured event. This is called by initComponent and should never need to be called again.
Available since: 1.1.0
Disable the component.
Available since: 1.1.0
Parameters
- silent : Boolean
Passing true, will supress the 'disable' event from being fired.
Returns
This method needs to be called whenever you change something on this component that requires the components layout to be recalculated. An example is adding, showing or hiding a docked item to a Panel, or changing the label of a form field. After a component layout, the container layout will automatically be run. So you could be on the safe side and always call doComponentLayout instead of doLayout.
Available since: 1.1.0
Parameters
- width : Object
- height : Object
- isSetSize : Object
Returns
- Ext.Container
this
private
Available since: 1.1.0
Parameters
- el : Object
- options : Object
Enable the component
Available since: 1.1.0
Parameters
- silent : Boolean
Passing false will supress the 'enable' event from being fired.
Returns
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.override(Ext.form.Field, {
// Add functionality to Field's initComponent to enable the change event to bubble
initComponent : Ext.createSequence(Ext.form.Field.prototype.initComponent, function() {
this.enableBubble('change');
}),
// We know that we want Field's events to bubble directly to the FormPanel.
getBubbleTarget : function() {
if (!this.formPanel) {
this.formPanel = this.findParentByType('form');
}
return this.formPanel;
}
});
var myForm = new Ext.formPanel({
title: 'User Details',
items: [{
...
}],
listeners: {
change: function() {
// Title goes red if form has been modified.
myForm.header.setStyle('color', 'red');
}
}
});
Available since: 1.1.0
Parameters
- events : String/Array
The event name to bubble, or an Array of event names.
Fires the specified event with the passed parameters (minus the event name).
An event may be set to bubble up an Observable parent hierarchy (See Ext.Component.getBubbleTarget) by calling enableBubble.
Available since: 1.1.0
Parameters
- eventName : String
The name of the event to fire.
- args : Object...
Variable number of parameters are passed to handlers.
Returns
- Boolean
returns false if any of the handlers return false otherwise it returns true.
Gets the text for this Button's badge
Available since: 1.1.0
Returns
- String
The button text
Provides the link for Observable's fireEvent method to bubble up the ownership hierarchy.
Available since: 1.1.0
Returns
- Ext.Container
the Container which owns this Component.
Retrieves the top level element representing this component.
Available since: 1.1.0
Gets the current height of the component's underlying element.
Available since: 1.1.0
Returns
- Number
Retrieves the id of this component. Will autogenerate an id if one has not already been set.
Available since: 1.1.0
This function takes the position argument passed to onRender and returns a DOM element that you can use in the insertBefore.
Available since: 1.1.0
Parameters
- position : String/Number/Element/HTMLElement
Index, element id or element you want to put this component before.
Returns
- HTMLElement
DOM element that you can use in the insertBefore
Gets the current size of the component's underlying element.
Available since: 1.1.0
Returns
- Object
An object containing the element's size {width: (element width), height: (element height)}
This is used to determine where to insert the 'html', 'contentEl' and 'items' in this component.
Available since: 1.1.0
Gets the text for this Button
Available since: 1.1.0
Returns
- String
The button text
Gets the current width of the component's underlying element.
Available since: 1.1.0
Returns
- Number
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:
var t = new Ext.form.Text();
alert(t.getXTypes()); // alerts 'component/field/textfield'
Available since: 1.1.0
Returns
- String
The xtype hierarchy string
Checks to see if this object has any listeners for a specified event
Available since: 1.1.0
Parameters
- eventName : String
The name of the event to check for
Returns
- Boolean
True if the event is being listened for, else false
Hide the component
Available since: 1.1.0
Parameters
- animation : Object/String/Boolean (optional)
Defaults to false.
Returns
- Ext.Component
this
Creates an array of class names from the configurations to add to this Component's el on render.
Private, but (possibly) used by ComponentQuery for selection by class name if Component is not rendered.
Available since: 1.1.0
Returns
- Array
An array of class names with which the Component's element will be rendered.
Adds ctCls to container.
Available since: 1.1.0
Parameters
- container : Object
Returns
- Ext.Element
The initialized container
Initializes this components contents. It checks for the properties html, contentEl and tpl/data.
Available since: 1.1.0
Initialized the renderData to be used when rendering the renderTpl.
Available since: 1.1.0
Returns
- Object
Object with keys and values that are going to be applied to the renderTpl
Initializes the renderTpl.
Available since: 1.1.0
Returns
- Ext.XTemplate
The renderTpl XTemplate instance.
Function description
Available since: 1.1.0
Returns
- String
A CSS style string with style, padding, margin and border.
Method to determine whether this Component is currently disabled.
Available since: 1.1.0
Returns
- Boolean
the disabled state of this Component.
Method to determine whether this Component is draggable.
Available since: 1.1.0
Returns
- Boolean
the draggable state of this component.
Method to determine whether this Component is droppable.
Available since: 1.1.0
Returns
- Boolean
the droppable state of this component.
Method to determine whether this Component is floating.
Available since: 1.1.0
Returns
- Boolean
the floating state of this component.
Method to determine whether this Component is currently set to hidden.
Available since: 1.1.0
Returns
- Boolean
the hidden state of this Component.
Returns true if this component is visible.
Available since: 1.1.0
Returns
- Boolean
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:
var t = new Ext.form.Text();
var isText = t.isXType('textfield'); // true
var isBoxSubclass = t.isXType('field'); // true, descended from Ext.form.Field
var isBoxInstance = t.isXType('field', true); // false, not a direct Ext.form.Field instance
Available since: 1.1.0
Parameters
- xtype : String
The xtype to check for this Component
- shallow : Boolean (optional)
False to check whether this Component is descended from the xtype (this is the default), or true to check whether this Component is directly of the specified xtype.
Returns
- Boolean
True if this component descends from the specified xtype, false otherwise.
Returns the next sibling of this Component.
Optionally selects the next sibling which matches the passed ComponentQuery selector.
May also be refered to as prev()
Available since: 1.1.0
Parameters
- selector : Object
Optional. A ComponentQuery selector to filter the following items.
Returns
- Object
The next sibling (or the next sibling which matches the selector). Returns null if there is no matching sibling.
Appends an event handler to this object (shorthand for addListener.)
Available since: 1.1.0
Parameters
- eventName : String
The type of event to listen for
- handler : Function
The method the event invokes
- scope : Object (optional)
The scope (
thisreference) 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.
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.
Available since: 1.1.0
Parameters
- container : Ext.Container
Container which holds the component
- pos : number
Position at which the component was added
Available since: 1.1.0
Parameters
- animation : Object
- fireHideEvent : Object
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.
Available since: 1.1.0
Parameters
- x : Number
The new x position
- y : Number
The new y position
Method to manage awareness of when components are removed from their respective Container, firing an removed event. References are properly cleaned up after removing a component from its owning container.
Available since: 1.1.0
Returns the previous sibling of this Component.
Optionally selects the previous sibling which matches the passed ComponentQuery selector.
May also be refered to as prev()
Available since: 1.1.0
Parameters
- selector : Object
Optional. A ComponentQuery selector to filter the preceding items.
Returns
- Object
The previous sibling (or the previous sibling which matches the selector). Returns null if there is no matching sibling.
Relays selected events from the specified Observable as if the events were fired by this.
Available since: 1.1.0
Parameters
- o : Object
The Observable whose events this object is to relay.
- events : Array
Array of event names to relay.
Removes a CSS class from the top level element representing this component.
Available since: 1.1.0
Returns
- Ext.Component
Returns the Component to allow method chaining.
Removes an event handler.
Available since: 1.1.0
Parameters
- eventName : String
The type of event the handler was associated with.
- handler : 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.
Removes listeners that were added by the mon method.
Available since: 1.1.0
Parameters
- item : Observable|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
enameparameter was an event name, this is the handler function. - scope : Object
Optional. If the
enameparameter was an event name, this is the scope (thisreference) in which the handler function is executed.
Resume 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.
Available since: 1.1.0
Creates a badge overlay on the button for displaying notifications.
Available since: 1.1.0
Parameters
- text : String
The text going into the badge. If you pass null or undefined the badge will be removed.
Returns
- Ext.Button
this
Show this component centered of its parent or the window This only applies when the component is floating.
Available since: 1.1.0
Parameters
- centered : Boolean
True to center, false to remove centering
Returns
- Ext.Component
this
Enable or disable the component.
Available since: 1.1.0
Parameters
- disabled : Boolean
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)
Available since: 1.1.0
Parameters
- dock : Object
- layoutParent : Object
Returns
- Component
this
Sets a Component as draggable.
Available since: 1.1.0
Parameters
- draggable : Boolean/Mixed
On first call, this can be a config object for Ext.util.Draggable. Afterwards, if set to false, the existing draggable object will be disabled
- autoShow : Boolean
Sets a Component as floating.
Available since: 1.1.0
Parameters
- floating : Boolean
- autoShow : Boolean
Assigns this Button's click handler
Available since: 1.1.0
Parameters
- handler : Function
The function to call when the button is clicked
- scope : Object (optional)
The scope (
thisreference) in which the handler function is executed. Defaults to this Button.
Returns
- Ext.Button
this
Sets the height of the component. This method fires the resize event.
Available since: 1.1.0
Parameters
- height : Number
The new height to set. This may be one of:
- A Number specifying the new height in the Element's Ext.Element.defaultUnits (by default, pixels).
- A String used to set the CSS height style.
- undefined to leave the height unchanged.
Returns
- Ext.Component
this
Sets the background image (inline style) of the button. This method also changes the value of the icon config internally.
Available since: 1.1.0
Parameters
- icon : String
The path to an image to display in the button. If you pass null or undefined the icon will be removed.
Returns
- Ext.Button
this
Adds a CSS class to the button that changes the align of the button's icon (if one has been defined). If no icon or iconClass has been defined, it will only set the value of the iconAlign internal config.
Available since: 1.1.0
Parameters
- alignment : String
The alignment you would like to align the button. Valid options are 'top', 'bottom', 'left', 'right'.
If you pass false, it will remove the current iconAlign. If you pass nothing or an invalid alignment, it will default to the last used/default iconAlign.
Returns
- Ext.Button
this
Sets the CSS class that provides a background image to use as the button's icon. This method also changes the value of the iconCls config internally.
Available since: 1.1.0
Parameters
- cls : String
The CSS class providing the icon image. If you pass null or undefined the iconCls will be removed.
Returns
- Ext.Button
this
This method allows you to show or hide a LoadMask on top of this component.
Available since: 1.1.0
Parameters
- load : Boolean/Object
True to show the default LoadMask or a config object that will be passed to the LoadMask constructor. False to hide the current LoadMask.
- targetEl : Boolean
True to mask the targetEl of this Component instead of the this.el. For example, setting this to true on a Panel will cause only the body to be masked. (defaults to false)
Returns
- Ext.LoadMask
The LoadMask instance that has just been shown.
Sets the orientation for the Panel.
Available since: 1.1.0
Parameters
- orientation : String
'landscape' or 'portrait'
- width : Number/String
New width of the Panel.
- height : Number/String
New height of the Panel.
Sets the left and top of the component. To set the page XY position instead, use setPagePosition. This method fires the move event.
Available since: 1.1.0
Parameters
- left : Number
The new left
- top : Number
The new top
Returns
- Ext.Component
this
Sets a Component as scrollable.
Available since: 1.1.0
Parameters
- config : Mixed
Acceptable values are a Ext.Scroller configuration, 'horizontal', 'vertical', 'both', and false
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}.
Available since: 1.1.0
Parameters
- width : Mixed
The new width to set. This may be one of:
- A Number specifying the new width in the Element's Ext.Element.defaultUnits (by default, pixels).
- A String used to set the CSS width style.
- A size object in the format
{width: widthValue, height: heightValue}. undefinedto leave the width unchanged.
- height : Mixed
The new height to set (not required if a size object is passed as the first arg). This may be one of:
- A Number specifying the new height in the Element's Ext.Element.defaultUnits (by default, pixels).
- A String used to set the CSS height style. Animation may not be used.
undefinedto leave the height unchanged.
Returns
- Ext.Component
this
Sets this Button's text
Available since: 1.1.0
Parameters
- text : String
The button text. If you pass null or undefined the text will be removed.
Returns
- Ext.Button
this
Convenience function to hide or show this component by boolean.
Available since: 1.1.0
Parameters
- visible : Boolean
True to show, false to hide
Returns
- Ext.Component
this
Sets the width of the component. This method fires the resize event.
Available since: 1.1.0
Parameters
- width : Number
The new width to setThis may be one of:
- A Number specifying the new width in the Element's Ext.Element.defaultUnits (by default, pixels).
- A String used to set the CSS width style.
Returns
- Ext.Component
this
Show the component.
Available since: 1.1.0
Parameters
- animation : Object/String/Boolean (optional)
Defaults to false.
Returns
- Ext.Component
this
Overrides: Ext.lib.Component.show
Show this component relative another component or element.
Available since: 1.1.0
Parameters
- alignTo : Mixed
Element or Component
- animation : Object/String/Boolean
- allowOnSide : Boolean
true to allow this element to be aligned on the left or right.
Returns
- Ext.Component
this
Suspend the firing of all events. (see resumeEvents)
Available since: 1.1.0
Parameters
- queueSuspended : Boolean
Pass as true to queue up suspended events to be fired after the resumeEvents call instead of discarding all suspended events;
Removes an event handler (shorthand for removeListener.)
Available since: 1.1.0
Parameters
- eventName : String
The type of event the handler was associated with.
- handler : 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.
Walks up the ownerCt axis looking for an ancestor Container which matches
the passed simple selector.
Example:
var owningTabContainer = grid.up('tabcontainer');
Available since: 1.1.0
Parameters
- selector : String
Optional. The simple selector to test.
Returns
- Ext.Container
The matching ancestor Container (or
undefinedif no match was found).
Inherit docs
Update the content area of a component.
Available since: 1.1.0
Parameters
- htmlOrData : Mixed
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
Overrides: Ext.lib.Component.update
Events
Fires after a Component has been visually activated.
Available since: 1.1.0
Parameters
- this : Ext.Component
Fires after a Component had been added to a Container.
Available since: 1.1.0
Parameters
- this : Ext.Component
- container : Ext.Container
Parent Container
- pos : Number
position of Component
Fires after the component rendering is finished.
The afterrender event is fired after this Component has been rendered, been postprocesed by any afterRender method defined for the Component, and, if stateful, after state has been restored.
Available since: 1.1.0
Parameters
- this : Ext.Component
Fires before a Component has been visually activated. Returning false from an event listener can prevent the activate from occurring.
Available since: 1.1.0
Parameters
- this : Ext.Component
Fires before a Component has been visually deactivated. Returning false from an event listener can prevent the deactivate from occurring.
Available since: 1.1.0
Parameters
- this : Ext.Component
Fires before the component is destroyed. Return false from an event handler to stop the destroy.
Available since: 1.1.0
Parameters
- this : Ext.Component
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
Parameters
- this : Ext.Component
Fires before the orientation changes, if the monitorOrientation configuration is set to true. Return false to stop the orientation change.
Available since: 1.1.0
Parameters
- this : Ext.Panel
- orientation : String
'landscape' or 'portrait'
- width : Number
- height : Number
Fires before the component is rendered. Return false from an event handler to stop the render.
Available since: 1.1.0
Parameters
- this : Ext.Component
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
Parameters
- this : Ext.Component
Fires when the button is tapped but before we call the handler or fire the tap event. Return false in a handler to prevent this.
Available since: 1.1.0
Parameters
- this : Ext.Button
- e : Ext.EventObject
Fires after a Component has been visually deactivated.
Available since: 1.1.0
Parameters
- this : Ext.Component
Fires after the component is hidden. Fires after the component is hidden when calling the hide method.
Available since: 1.1.0
Parameters
- this : Ext.Component
Fires after the component is moved.
Available since: 1.1.0
Parameters
- this : Ext.Component
- x : Number
The new x position
- y : Number
The new y position
Fires when the orientation changes, if the monitorOrientation configuration is set to true.
Available since: 1.1.0
Parameters
- this : Ext.Panel
- orientation : String
'landscape' or 'portrait'
- width : Number
- height : Number
Fires when a component is removed from an Ext.Container
Available since: 1.1.0
Parameters
- this : Ext.Component
- ownerCt : Ext.Container
Container which holds the component
Fires after the component is resized.
Available since: 1.1.0
Parameters
- this : Ext.Component
- adjWidth : Number
The box-adjusted width that was set
- adjHeight : Number
The box-adjusted height that was set
- rawWidth : Number
The width that was originally specified
- rawHeight : Number
The height that was originally specified
Fires after the component is shown when calling the show method.
Available since: 1.1.0
Parameters
- this : Ext.Component
Fires when the button is tapped.
Available since: 1.1.0
Parameters
- this : Ext.Button
- e : Ext.EventObject
CSS Variables
Default size (width and height) for toolbar icons.
Defaults to: 1.4em
Available since: Touch 1.1.1