Observable Component Component
Package: | Ext |
Defined In: | Component.js |
Class: | Component |
Subclasses: | Button, Carousel.Indicator, DataView, Map, Spacer, Container |
Extends: | Component |
Base class for all Ext components. All subclasses of Component may participate in the automated Ext component lifecycle of creation, rendering and destruction which is provided by the Container class. Components may be added to a Container through the items config option at the time the Container is created, or they may be added dynamically via the add method.
The Component base class has built-in support for basic hide/show and enable/disable behavior.
All Components are registered with the Ext.ComponentMgr on construction so that they can be referenced at any time via Ext.getCmp, passing the id.
All user-developed visual widgets that are required to participate in automated lifecycle and size management should subclass Component (or Ext.BoxComponent if managed box model handling is required, ie height and width management).
See the Creating new UI controls tutorial for details on how and to either extend or augment ExtJs base classes to create custom Components.
Every component has a specific xtype, which is its Ext-specific type name, along with methods for checking the xtype like getXType and isXType. This is the list of all valid xtypes:
xtype Class ------------- ------------------ button Ext.Button component Ext.Component container Ext.Container dataview Ext.DataView panel Ext.Panel slider Ext.form.Slider toolbar Ext.Toolbar spacer Ext.Spacer tabpanel Ext.TabPanel Form components --------------------------------------- formpanel Ext.form.FormPanel checkboxfield Ext.form.Checkbox selectfield Ext.form.Select field Ext.form.Field fieldset Ext.form.FieldSet hiddenfield Ext.form.Hidden numberfield Ext.form.Number radiofield Ext.form.Radio textareafield Ext.form.TextArea textfield Ext.form.Text togglefield Ext.form.Toggle
Config Options | Defined By | |
---|---|---|
baseCls : String The base CSS class to apply to this components's element. This will also be prepended to
elements within this compone... The base CSS class to apply to this components'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. | Component | |
border : Number/String Specifies the border for this component. The border can be a single numeric value to apply to all sides or
it can be ... 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'. | Component | |
centered : Boolean Center the Component. Defaults to false. | Component | |
cls : String An optional extra CSS class that will be added to this component's Element (defaults to ''). This can be
useful for ... An optional extra CSS class that will be added to this component's Element (defaults to ''). This can be
useful for adding customized styles to the component or any of its children using standard CSS rules. | Component | |
componentCls : String CSS Class to be added to a components root level element to give distinction to it
via styling. | Component | |
componentLayout : String/Object The sizing and positioning of the component Elements is the responsibility of
the Component's layout manager which cr... 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. | Component | |
contentEl : String Optional. Specify an existing HTML element, or the id of an existing HTML element to use as the content
for this comp... Optional. Specify an existing HTML element, or the
| Component | |
data : Mixed The initial set of data to apply to the tpl to
update the content area of the Component. | Component | |
disabled : Boolean Defaults to false. | Component | |
disabledCls : String CSS class to add when the Component is disabled. Defaults to 'x-item-disabled'. | Component | |
draggable : Boolean Allows the component to be dragged via the touch event. | Component | |
floating : Boolean Create the Component as a floating and use absolute positioning.
Defaults to false. | Component | |
floatingCls : Boolean The class that is being added to this component when its floating.
(defaults to x-floating) | Component | |
height : Number The height of this component in pixels. | Component | |
hidden : Boolean Defaults to false. | Component | |
hideOnMaskTap : Boolean True to automatically bind a tap listener to the mask that hides the window.
Defaults to true. Note: if you set this ... 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. | Component | |
html : String/Object An HTML fragment, or a DomHelper specification to use as the layout element
content (defaults to ''). The HTML conten... 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. | Component | |
listeners : Object A config object containing one or more event handlers to be added to this
object during initialization. This should ... 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
| Observable | |
margin : Number/String Specifies the margin for this component. The margin can be a single numeric value to apply to all sides or
it can be ... 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'. | Component | |
maxHeight : Number The maximum value in pixels which this Component will set its height to.
Warning: This will override any size managem... The maximum value in pixels which this Component will set its height to. Warning: This will override any size management applied by layout managers. | Component | |
maxWidth : Number The maximum value in pixels which this Component will set its width to.
Warning: This will override any size manageme... The maximum value in pixels which this Component will set its width to. Warning: This will override any size management applied by layout managers. | Component | |
minHeight : Number The minimum value in pixels which this Component will set its height to.
Warning: This will override any size managem... The minimum value in pixels which this Component will set its height to. Warning: This will override any size management applied by layout managers. | Component | |
minWidth : Number The minimum value in pixels which this Component will set its width to.
Warning: This will override any size manageme... The minimum value in pixels which this Component will set its width to. Warning: This will override any size management applied by layout managers. | Component | |
modal : Boolean True to make the Component modal and mask everything behind it when displayed, false to display it without
restrictin... 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). | Component | |
monitorOrientation : Boolean Monitor Orientation change | Component | |
padding : Number/String Specifies the padding for this component. The padding can be a single numeric value to apply to all sides or
it can b... 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'. | Component | |
plugins : Object/Array An object or array of objects that will provide custom functionality for this component. The only
requirement for a ... 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. | Component | |
renderTo : Mixed Specify the id of the element, a DOM element or an existing Element that this component
will be rendered into.
Notes ... Specify the id of the element, a DOM element or an existing Element that this component will be rendered into.
See render also. | Component | |
renderTpl : Mixed An XTemplate used to create the Element which will
encapsulate this Component.
You do not normally need to specify th... An XTemplate used to create the Element which will encapsulate this Component. You do not normally need to specify this. For the base classes Ext.Component, Ext.Component, and Ext.Container, this defaults to 'div'. The more complex Ext classes use a more complex DOM structure. This is intended to allow the developer to create application-specific utility Components encapsulated by different DOM elements. | Component | |
scroll : Mixed Configure the component to be scrollable. Acceptable values are:
'horizontal', 'vertical', 'both' to enabling scroll... | Component | |
showAnimation : Object/String/Boolean The type of animation you want to use when this component is shown. If you set this
this hide animation will automati... 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. | Component | |
stopMaskTapEvent : Boolean True to stop the event that fires when you click outside the floating component.
Defalts to true. | Component | |
style : String A custom style specification to be applied to this component's Element. Should be a valid argument to
Ext.Element.ap... A custom style specification to be applied to this component's Element. Should be a valid argument to
Ext.Element.applyStyles.
| Component | |
styleHtmlCls : String The class that is added to the content target when you set styleHtmlContent to true.
Defaults to 'x-html' | Component | |
styleHtmlContent : String True to automatically style the html inside the content target of this component (body for panels).
Defaults to false... True to automatically style the html inside the content target of this component (body for panels).
Defaults to false. | Component | |
tpl : Mixed An Ext.Template, Ext.XTemplate
or an array of strings to form an Ext.XTemplate.
Used in conjunction with the data and... An data and
tplWriteMode configurations. | Component | |
tplWriteMode : String The Ext.(X)Template method to use when
updating the content area of the Component. Defaults to 'overwrite'
(see Ext.X... The Ext.(X)Template method to use when
updating the content area of the Component. Defaults to 'overwrite'
(see Ext.XTemplate.overwrite ). | Component | |
ui : String A set of predefined ui styles for individual components.
Most components support 'light' and 'dark'.
Extra string add... A set of predefined ui styles for individual components.
Most components support 'light' and 'dark'.
Extra string added to the baseCls with an extra '-'.
The ui configuration in this example would add 'x-component-green' as an additional class. | Component | |
width : Number The width of this component in pixels. | Component |
Property | Defined By | |
---|---|---|
draggable : Boolean Read-only property indicating whether or not the component can be dragged | Component | |
rendered : Boolean Read-only property indicating whether or not the component has been rendered. | Component |
Method | Defined By | |
---|---|---|
Component( Ext.Element/String/Object config )
Parameters:
| Component | |
addCls()
:
void Adds a CSS class to the top level element representing this component. Adds a CSS class to the top level element representing this component. Parameters:
| Component | |
addEvents( Object|String o , string Optional. )
:
voidAdds the specified events to the list of events which this Observable may fire. Adds the specified events to the list of events which this Observable may fire. Parameters:
| Observable | |
addListener( String eventName , Function handler , [Object scope ], [Object options ] )
:
voidAppends an event handler to this object. Appends an event handler to this object. Parameters:
| Observable | |
addManagedListener( Observable|Element item , Object|String ename , Function fn , Object scope , Object opt )
:
voidAdds listeners to any Observable object (or Element) which are automatically removed when this Component
is destroyed... Adds listeners to any Observable object (or Element) which are automatically removed when this Component is destroyed. Parameters:
| Observable | |
clearListeners()
:
void Removes all listeners for this object including the managed listeners Removes all listeners for this object including the managed listeners Parameters:
| Observable | |
clearManagedListeners()
:
void Removes all managed listeners for this object. Removes all managed listeners for this object. Parameters:
| Observable | |
destroy()
:
void Destroys the Component. Destroys the Component. Parameters:
| Component | |
disable( Boolean silent )
:
voidDisable the component. Disable the component. Parameters:
| Component | |
doComponentLayout()
:
Ext.Container This method needs to be called whenever you change something on this component that requires the components
layout to... 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. Parameters:
| Component | |
enable( Boolean silent )
:
voidEnable the component Enable the component Parameters:
| Component | |
enableBubble( String/Array events )
:
voidEnables events fired by this Observable to bubble up an owner hierarchy by calling
this.getBubbleTarget() if present.... Enables events fired by this Observable to bubble up an owner hierarchy by calling
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:
Parameters:
| Observable | |
fireEvent( String eventName , Object... args )
:
BooleanFires the specified event with the passed parameters (minus the event name).
An event may be set to bubble up an Obse... 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. Parameters:
| Observable | |
getBubbleTarget()
:
Ext.Container Provides the link for Observable's fireEvent method to bubble up the ownership hierarchy. Provides the link for Observable's fireEvent method to bubble up the ownership hierarchy. Parameters:
| Component | |
getEl()
:
void Retrieves the top level element representing this component. Retrieves the top level element representing this component. Parameters:
| Component | |
getHeight()
:
Number Gets the current height of the component's underlying element. Gets the current height of the component's underlying element. Parameters:
| Component | |
getId()
:
void Retrieves the id of this component.
Will autogenerate an id if one has not already been set. Retrieves the id of this component.
Will autogenerate an id if one has not already been set. Parameters:
| Component | |
getInsertPosition( String/Number/Element/HTMLElement position )
:
HTMLElementThis function takes the position argument passed to onRender and returns a
DOM element that you can use in the insert... This function takes the position argument passed to onRender and returns a
DOM element that you can use in the insertBefore. Parameters:
| Component | |
getSize()
:
Object Gets the current size of the component's underlying element. Gets the current size of the component's underlying element. Parameters:
| Component | |
getWidth()
:
Number Gets the current width of the component's underlying element. Gets the current width of the component's underlying element. Parameters:
| Component | |
getXTypes()
:
String Returns this Component's xtype hierarchy as a slash-delimited string. For a list of all
available xtypes, see the Ext... 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:
Parameters:
| Component | |
hasListener( String eventName )
:
BooleanChecks to see if this object has any listeners for a specified event Checks to see if this object has any listeners for a specified event Parameters:
| Observable | |
hide( [Object/String/Boolean animation ] )
:
voidHide the component Hide the component Parameters:
| Component | |
isDisabled()
:
Boolean Method to determine whether this Component is currently disabled. Method to determine whether this Component is currently disabled. Parameters:
| Component | |
isDraggable()
:
Boolean Method to determine whether this Component is draggable. Method to determine whether this Component is draggable. Parameters:
| Component | |
isDroppable()
:
Boolean Method to determine whether this Component is droppable. Method to determine whether this Component is droppable. Parameters:
| Component | |
isFloating()
:
Boolean Method to determine whether this Component is floating. Method to determine whether this Component is floating. Parameters:
| Component | |
isHidden()
:
Boolean Method to determine whether this Component is currently set to hidden. Method to determine whether this Component is currently set to hidden. Parameters:
| Component | |
isVisible()
:
Boolean Returns true if this component is visible. Returns true if this component is visible. Parameters:
| Component | |
isXType( String xtype , [Boolean shallow ] )
:
BooleanTests whether or not this Component is of a specific xtype. This can test whether this Component is descended
from th... 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:
Parameters:
| Component | |
on( String eventName , Function handler , [Object scope ], [Object options ] )
:
voidAppends an event handler to this object (shorthand for addListener.) Appends an event handler to this object (shorthand for addListener.) Parameters:
| Observable | |
relayEvents( Object o , Array events )
:
voidRelays selected events from the specified Observable as if the events were fired by this. Relays selected events from the specified Observable as if the events were fired by this. Parameters:
| Observable | |
removeCls()
:
void Removes a CSS class from the top level element representing this component. Removes a CSS class from the top level element representing this component. Parameters:
| Component | |
removeListener( String eventName , Function handler , [Object scope ] )
:
voidRemoves an event handler. Removes an event handler. Parameters:
| Observable | |
removeManagedListener( Observable|Element item , Object|String ename , Function fn , Object scope )
:
voidRemoves listeners that were added by the mon method. Removes listeners that were added by the mon method. Parameters:
| Observable | |
resumeEvents()
:
void Resume firing events. (see suspendEvents)
If events were suspended using the queueSuspended parameter, then all
event... 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. Parameters:
| Observable | |
setCentered( Boolean centered )
:
voidShow this component centered of its parent or the window
This only applies when the component is floating. Show this component centered of its parent or the window
This only applies when the component is floating. Parameters:
| Component | |
setDisabled( Boolean disabled )
:
voidEnable or disable the component. Enable or disable the component. Parameters:
| Component | |
setDocked()
:
Component Sets the dock position of this component in its parent panel. Note that
this only has effect if this item is part of ... 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) Parameters:
| Component | |
setDraggable( Boolean/Mixed draggable , Boolean autoShow )
:
voidSets a Component as draggable. Sets a Component as draggable. Parameters:
| Component | |
setFloating( Boolean floating , Boolean autoShow )
:
voidSets a Component as floating. Sets a Component as floating. Parameters:
| Component | |
setHeight( Number height )
:
Ext.ComponentSets the height of the component. This method fires the resize event. Sets the height of the component. This method fires the resize event. Parameters:
| Component | |
setLoading( Boolean/Object load , Boolean targetEl )
:
Ext.LoadMaskThis method allows you to show or hide a LoadMask on top of this component. This method allows you to show or hide a LoadMask on top of this component. Parameters:
| Component | |
setOrientation( String orientation , Number/String width , Number/String height )
:
voidSets the orientation for the Panel. Sets the orientation for the Panel. Parameters:
| Component | |
setPosition( Number left , Number top )
:
Ext.ComponentSets the left and top of the component. To set the page XY position instead, use setPagePosition.
This method fires ... Sets the left and top of the component. To set the page XY position instead, use setPagePosition.
This method fires the move event. Parameters:
| Component | |
setScrollable( Mixed config )
:
voidSets a Component as scrollable. Sets a Component as scrollable. Parameters:
| Component | |
setSize( Mixed width , Mixed height )
:
Ext.ComponentSets the width and height of this Component. This method fires the resize event. This method can accept
either width ... 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} .Parameters:
| Component | |
setVisible( Boolean visible )
:
Ext.ComponentConvenience function to hide or show this component by boolean. Convenience function to hide or show this component by boolean. Parameters:
| Component | |
setWidth( Number width )
:
Ext.ComponentSets the width of the component. This method fires the resize event. Sets the width of the component. This method fires the resize event. Parameters:
| Component | |
show( [Object/String/Boolean animation ] )
:
voidShow the component. Show the component. Parameters:
| Component | |
showBy( Mixed alignTo , Object/String/Boolean animation , Boolean allowOnSide )
:
voidShow this component relative another component or element. Show this component relative another component or element. Parameters:
| Component | |
suspendEvents( Boolean queueSuspended )
:
voidSuspend the firing of all events. (see resumeEvents) Suspend the firing of all events. (see resumeEvents) Parameters:
| Observable | |
un( String eventName , Function handler , [Object scope ] )
:
voidRemoves an event handler (shorthand for removeListener.) Removes an event handler (shorthand for removeListener.) Parameters:
| Observable | |
update( Mixed htmlOrData , [Boolean loadScripts ], [Function callback ] )
:
voidUpdate the content area of a component. Update the content area of a component. Parameters:
| Component |
Event | Defined By | |
---|---|---|
activate :
( Ext.Component this )
Fires after a Component has been visually activated. Fires after a Component has been visually activated. Listeners will be called with the following arguments:
| Component | |
added :
( Ext.Component this , Ext.Container container , Number pos )
Fires after a Component had been added to a Container. Fires after a Component had been added to a Container. Listeners will be called with the following arguments:
| Component | |
afterrender :
( Ext.Component this )
Fires after the component rendering is finished.
The afterrender event is fired after this Component has been rendere... 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. Listeners will be called with the following arguments:
| Component | |
beforeactivate :
( Ext.Component this )
Fires before a Component has been visually activated.
Returning false from an event listener can prevent the activate... Fires before a Component has been visually activated.
Returning false from an event listener can prevent the activate
from occurring. Listeners will be called with the following arguments:
| Component | |
beforedeactivate :
( Ext.Component this )
Fires before a Component has been visually deactivated.
Returning false from an event listener can prevent the deacti... Fires before a Component has been visually deactivated.
Returning false from an event listener can prevent the deactivate
from occurring. Listeners will be called with the following arguments:
| Component | |
beforedestroy :
( Ext.Component this )
| Component | |
beforehide :
( Ext.Component this )
Fires before the component is hidden when calling the hide method.
Return false from an event handler to stop the hid... Fires before the component is hidden when calling the hide method.
Return false from an event handler to stop the hide. Listeners will be called with the following arguments:
| Component | |
beforeorientationchange :
( Ext.Panel this , String orientation , Number width , Number height )
Fires before the orientation changes, if the monitorOrientation
configuration is set to true. Return false to stop th... Fires before the orientation changes, if the monitorOrientation
configuration is set to true. Return false to stop the orientation change. Listeners will be called with the following arguments:
| Component | |
beforerender :
( Ext.Component this )
| Component | |
beforeshow :
( Ext.Component this )
Fires before the component is shown when calling the show method.
Return false from an event handler to stop the show... Fires before the component is shown when calling the show method.
Return false from an event handler to stop the show. Listeners will be called with the following arguments:
| Component | |
deactivate :
( Ext.Component this )
Fires after a Component has been visually deactivated. Fires after a Component has been visually deactivated. Listeners will be called with the following arguments:
| Component | |
destroy :
( Ext.Component this )
Fires after the component is destroyed. Fires after the component is destroyed. Listeners will be called with the following arguments:
| Component | |
disable :
( Ext.Component this )
Fires after the component is disabled. Fires after the component is disabled. Listeners will be called with the following arguments:
| Component | |
enable :
( Ext.Component this )
Fires after the component is enabled. Fires after the component is enabled. Listeners will be called with the following arguments:
| Component | |
hide :
( Ext.Component this )
Fires after the component is hidden.
Fires after the component is hidden when calling the hide method. Fires after the component is hidden.
Fires after the component is hidden when calling the hide method. Listeners will be called with the following arguments:
| Component | |
move :
( Ext.Component this , Number x , Number y )
Fires after the component is moved. Fires after the component is moved. Listeners will be called with the following arguments:
| Component | |
orientationchange :
( Ext.Panel this , String orientation , Number width , Number height )
Fires when the orientation changes, if the monitorOrientation
configuration is set to true. Fires when the orientation changes, if the monitorOrientation
configuration is set to true. Listeners will be called with the following arguments:
| Component | |
removed :
( Ext.Component this , Ext.Container ownerCt )
Fires when a component is removed from an Ext.Container Fires when a component is removed from an Ext.Container Listeners will be called with the following arguments:
| Component | |
render :
( Ext.Component this )
Fires after the component markup is rendered. Fires after the component markup is rendered. Listeners will be called with the following arguments:
| Component | |
resize :
( Ext.Component this , Number adjWidth , Number adjHeight , Number rawWidth , Number rawHeight )
Fires after the component is resized. Fires after the component is resized. Listeners will be called with the following arguments:
| Component | |
show :
( Ext.Component this )
Fires after the component is shown when calling the show method. Fires after the component is shown when calling the show method. Listeners will be called with the following arguments:
| Component |