You are on page 1of 111

Class Ext.formClass Ext.form.

FormPanel
Package: Ext.form Defined In: FormPanel.js Class: FormPanel Extends: Panel Simple form panel which enables easy getting and setting of field values. Can load model instances. Example usage:
var form = new Ext.form.FormPanel({ items: [ { xtype: 'textfield', name : 'first', label: 'First name' }, { xtype: 'textfield', name : 'last', label: 'Last name' }, { xtype: 'numberfield', name : 'age', label: 'Age' }, { xtype: 'urlfield', name : 'url', label: 'Website' } ] });

Loading model instances:


Ext.regModel('User', { fields: [ {name: 'first', {name: 'last', {name: 'age', {name: 'url', ] });

type: type: type: type:

'string'}, 'string'}, 'int'}, 'string'}

var user = Ext.ModelMgr.create({ first: 'Ed', last : 'Spencer', age : 24, url : 'http://extjs.com' }, 'User'); form.load(user);

Config Options
Config Options Defined By

activeItem : String/Number A string component id or the numeric index of the component that should be initially activated within the container's... A string component id or the numeric index of the component that should be initially Container activated within the container's layout on render. For example, activeItem: 'item-1' or activeItem: 0 (index 0 = the first item in the container's collection). activeItem only applies to layout styles that can display items one at a time (like Ext.layout.CardLayout and Ext.layout.FitLayout). Related to Ext.layout.ContainerLayout.activeItem. autoDestroy : Boolean If true the container will automatically destroy any contained component that is removed from it, else destruction mu... Container If true the container will automatically destroy any contained component that is removed from it, else destruction must be handled manually (defaults to true). baseCls : String Panel The base CSS class to apply to this panel's element (defaults to 'x-panel'). baseParams : Object Optional hash of params to be sent (when standardSubmit configuration is false) on every FormPanel submit. bodyBorder : Number/Boolean A shortcut for setting a border style on the body element. The value can either be a number to be applied to all side... Panel A shortcut for setting a border style on the body element. The value can either be a number to be applied to all sides, or a normal css string describing borders. Defaults to undefined. bodyMargin : Number/Boolean A shortcut for setting a margin style on the body element. The value can either be a number to be applied to all side... Panel A shortcut for setting a margin style on the body element. The value can either be a number to be applied to all sides, or a normal css string describing margins. Defaults to undefined. bodyPadding : Number/Boolean A shortcut for setting a padding style on the body element. The value can either be a number to be applied to all sid... Panel A shortcut for setting a padding style on the body element. The value can either be a number to be applied to all sides, or a normal css string describing padding. Defaults to undefined. 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 ... Component 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'. bubbleEvents : Array Container An array of events that, when fired, should be bubbled to any parent container. See

Ext.util.Observable.enableBubble.... An array of events that, when fired, should be bubbled to any parent container. See Ext.util.Observable.enableBubble. Defaults to ['add', 'remove']. cardSwitchAnimation : String/Mixed Animation to be used during transitions of cards. Note this only works when this container has a CardLayout. Any vali... Container Animation to be used during transitions of cards. Note this only works when this container has a CardLayout. Any valid value from Ext.anims can be used ('fade', 'slide', 'flip', 'cube', 'pop', 'wipe'). Defaults to null. centered : Boolean Component Center the Component. Defaults to false. cls : String An optional extra CSS class that will be added to this component's Element (defaults to ''). This can be useful for ... Component 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. componentCls : String CSS Class to be added to a components root level element to give distinction to it via Component styling. 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 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. 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 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.

Component

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 layout scheme that the Component may use. It is just HTML. Layouts operate on child items. Add either the x-hidden or the x-hide-display CSS class to prevent a brief flicker of the content before it is rendered to the panel. data : Mixed The initial set of data to apply to the tpl to update the content area of the Component. defaultType : String The default xtype of child Components to create in this Container when a child item is specified as a raw configurati... The default xtype of child Components to create in this Container when a child item is specified as a raw configuration object, rather than as an instantiated Component. Defaults to 'panel'. defaults : Object|Function This option is a means of applying default settings to all added items whether added through the items config or via ... This option is a means of applying default settings to all added items whether added through the items config or via the add or insert methods. If an added item is a config object, and not an instantiated Component, then the default properties are unconditionally applied. If the added item is an instantiated Component, then the default properties are applied conditionally so as not to override existing properties in the item. If the defaults option is specified as a function, then the function will be called using this Container as the scope (this reference) and passing the added item as the first parameter. Any resulting object from that call is then applied to the item as default properties. For example, to automatically apply padding to the body of each of a set of contained Ext.Panel items, you could pass: defaults: {bodyStyle:'padding:15px'}. Usage:
defaults: { container autoScroll:true }, items: [ { xtype: 'panel', id: 'panel1', autoScroll: false autoScroll:false }, // defaults are applied to items, not the

Component

Container

Container

// defaults do not have precedence over // options in config objects, so the defaults // will not be applied here, panel1 will be

new Ext.Panel({ // defaults do have precedence over options id: 'panel2', // options in components, so the defaults autoScroll: false // will be applied here, panel2 will be autoScroll:true. }) ]

disabled : Boolean Defaults to false. disabledCls : String CSS class to add when the Component is disabled. Defaults to 'x-item-disabled'. dockedItems : Object/Array A component or series of components to be added as docked items to this panel. The docked items can be docked to eith... A component or series of components to be added as docked items to this panel. The docked items can be docked to either the top, right, left or bottom of a panel. This is typically used for things like toolbars or tab bars:
var panel = new Ext.Panel({ fullscreen: true, dockedItems: [{ xtype: 'toolbar', dock: 'top', items: [{ text: 'Docked to the bottom' }] }] });

Component Component

Panel

draggable : Boolean Allows the component to be dragged via the touch event. floating : Boolean Create the Component as a floating and use absolute positioning. Defaults to false. floatingCls : Boolean The class that is being added to this component when its floating. (defaults to x-floating) fullscreen : Boolean Force the component to take up 100% width and height available. Defaults to false. Setting this configuration immedia... 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. height : Number The height of this component in pixels. hidden : Boolean Defaults to false. 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. html : String/Object An HTML fragment, or a DomHelper specification to use as the layout element content (defaults to ''). The HTML conten...

Component Component Component

Component

Component Component

Component

Component

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. items : Object/Array ** IMPORTANT: be sure to specify a layout if needed ! ** A single item, or an array of child Components to be added t...
** IMPORTANT: be sure to specify a layout if needed ! **

A single item, or an array of child Components to be added to this container, for example:
// specifying a single item items: {...}, layout: 'fit', // specify a layout! // specifying multiple items items: [{...}, {...}], layout: 'hbox', // specify a layout!

Each item may be:


any type of object based on Ext.Component a fully instanciated object or Container an object literal that: o has a specified xtype o the Ext.Component.xtype specified is associated with the Component desired and should be chosen from one of the available xtypes as listed in Ext.Component. o If an xtype is not explicitly specified, the defaultType for that Container is used. o will be "lazily instanciated", avoiding the overhead of constructing a fully instanciated Component object

Notes:

Ext uses lazy rendering. Child Components will only be rendered should it become necessary. Items are automatically laid out when they are first shown (no sizing is done while hidden), or in response to a doLayout call. Do not specify contentEl/ html with items.

layout : String/Object *Important: In order for child items to be correctly sized and positioned, typically a layout manager must be specifi... *Important: In order for child items to be correctly sized and positioned, typically a layout manager must be specified through the layout configuration option. Container

The sizing and positioning of child items is the responsibility of the Container's layout

manager which creates and manages the type of layout you have in mind. For example: If the layout configuration is not explicitly specified for a general purpose container (e.g. Container or Panel) the default layout manager will be used which does nothing but render child components sequentially into the Container (no sizing or positioning will be performed in this situation).

layout

may be specified as either as an Object or as a String: Specify as an Object o Example usage:


layout: { type: 'vbox', align: 'left' } o type

The layout type to be used for this container. If not specified, a default Ext.layout.ContainerLayout will be created and used.

Valid layout type values are:


o auto card fit hbox vbox

Default

Layout specific configuration properties

Additional layout specific configuration properties may also be specified. For complete details regarding the valid config options for each layout type, see the layout class corresponding to the type specified.

Specify as a String o Example usage:


layout: { type: 'vbox', padding: '5', align: 'left' }

layout

The layout type to be used for this container (see list of valid layout type values above).

Additional layout specific configuration properties. For complete details regarding the valid config options for each layout type, see the layout class corresponding to the layout specified. layoutOnOrientationChange : Boolean Set this to true to automatically relayout this component on orientation change. This property is set to true by defa... Set this to true to automatically relayout this component on orientation change. This Component 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 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

Observable 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'); } } } });

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 ... Component 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'. maxHeight : Number The maximum value in pixels which this Component will set its height to. Warning: This will override any size managem... Component The maximum value in pixels which this Component will set its height to. Warning: This will override any size management applied by layout managers. maxWidth : Number The maximum value in pixels which this Component will set its width to. Warning: This will override any size manageme... Component The maximum value in pixels which this Component will set its width to. Warning: This will override any size management applied by layout managers. minHeight : Number The minimum value in pixels which this Component will set its height to. Warning: This will override any size managem... Component The minimum value in pixels which this Component will set its height to. Warning: This will override any size management applied by layout managers. minWidth : Number The minimum value in pixels which this Component will set its width to. Warning: This will override any size manageme... Component The minimum value in pixels which this Component will set its width to. Warning: This will override any size management applied by layout managers. modal : Boolean True to make the Component modal and mask everything behind it when displayed, false to display it without restrictin... Component 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).

monitorOrientation : Boolean Component Monitor Orientation change 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... Component 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'. 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 Component 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. renderSelectors. : Object An object containing properties specifying DomQuery selectors which identify child elements created by the render pro... 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:

Component

renderTpl: ' "{imageUrl}" class="x-image-component-img"> "x-image-component-desc">{description} ', 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. renderTo : Mixed Specify the id of the element, a DOM element or an existing Element that this component will be rendered into. Notes ... Component 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. renderTpl : Mixed An XTemplate used to create the internal structure inside this Component's encapsulating Element. You do not normally... 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 Component 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. scroll : Mixed Configure the component to be scrollable. Acceptable values are: 'horizontal', 'vertical', 'both' to enabling scroll... 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.

Component

Enabling scrolling immediately sets the monitorOrientation config to true (for Panel) 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... Component 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. standardSubmit : Boolean FormPanel Wether or not we want to perform a standard form submit. Defaults to false stopMaskTapEvent : Boolean Component True to stop the event that fires when you click outside the floating component. Defalts to

true. 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.
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' } }) ] });

Component

styleHtmlCls : String The class that is added to the content target when you set styleHtmlContent to true. Defaults to 'x-html' 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. submitOnAction : Object When this is set to true, the form will automatically submit itself whenever the 'action' event fires on a field in t... When this is set to true, the form will automatically submit itself whenever the 'action' event fires on a field in this form. The action event usually fires whenever you press go or enter inside a textfield. 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 Ext.Template, Ext.XTemplate or an array of strings to form an Ext.XTemplate. Used in conjunction with the data and tplWriteMode configurations. 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). ui : String

Component

Component

FormPanel

Component

Component

Component

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 '-'.
new Ext.Panel({ title: 'Some Title', baseCls: 'x-component' ui: 'green' });

The ui configuration in this example would add 'x-component-green' as an additional class. url : String The default Url for submit actions waitTpl : Object The defined waitMsg template. Used for precise control over the masking agent used to mask the FormPanel (or other E... The defined waitMsg template. Used for precise control over the masking agent used to mask the FormPanel (or other Element) during form Ajax/submission actions. For more options, see showMask method. width : Number The width of this component in pixels.

FormPanel

FormPanel

Component

Public Properties
Property Defined By draggable : Boolean Component Read-only property indicating whether or not the component can be dragged items : Ext.util.MixedCollection Container The MixedCollection containing all the child items of this container. record : Ext.data.Model FormPanel The Model instance currently loaded into this form (if any). Read only rendered : Boolean Component Read-only property indicating whether or not the component has been rendered.

Public Methods
Method add( ...Object/Array component ) : Ext.Component/Array Adds Component(s) to this Container. Description : <ul class="mdetail-params"> Fires the beforeadd event before addin... Adds Component(s) to this Container. Defined By

Contain er

Description :

Fires the beforeadd event before adding The Container's default config values will be applied accordingly (see defaults for details). Fires the add event after the component has been added.

Notes :

If the Container is already rendered when add is called, you may need to call 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. For example:
var tb = new Ext.Toolbar(); tb.render(document.body); // toolbar is rendered tb.add({text:'Button 1'}); // add multiple items (defaultType for Toolbar is 'button') tb.add({text:'Button 2'}); tb.doLayout(); // refresh the layout

Warning: Containers directly managed by the BorderLayout layout manager may not be removed or added. See the Notes for BorderLayout for more details.

Parameters:
component

: ...Object/Array

Either one or more Components to add or an Array of Components to add. See items for additional information. Returns:
Ext.Component/Array

The Components that were added. 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:

None.

Compon ent

Returns:

void

addDocked( Object/Array component., [Number pos] ) : void Adds docked item(s) to the panel. Adds docked item(s) to the panel. Parameters:
component.

: Object/Array

The Component or array of components to add. The components must include a 'dock' paramater on each component to indicate where it should be docked ('top', 'right', 'bottom', 'left'). Panel
pos

: Number

(optional) The index at which the Component will be added Returns:

void

addEvents( Object|String o, string Optional. ) : void Adds 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:
o

: Object|String

Either an object with event names as properties with a value of true or the first event name string if multiple event names are being passed as separate parameters. Observa ble Optional. : string Event name if multiple event names are being passed as separate parameters. Usage:
this.addEvents('storeloaded', 'storecleared');

Returns:

void

addListener( String eventName, Function handler, [Object scope], [Object options] ) : void Appends an event handler to this object. Appends an event handler to this object. Observa Parameters: ble
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 (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. properties. This may contain any of the following properties:
o

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.

target : 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 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 });

. Returns:

void

addManagedListener( Observable|Element item, Object|String ename, Function fn, Object scope, Object opt ) : void Adds listeners to any Observable object (or Element) which are automatically removed when Observa ble this Component is destroyed... Adds listeners to any Observable object (or Element) which are automatically removed when

this Component is destroyed. 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 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.
opt

: Object

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

void

child( String selector ) : Ext.Component Retrieves the first direct child of this container which matches the passed selector. The passed in selector must com... Retrieves the first direct child of this container which matches the passed selector. The passed in selector must comply with an Ext.ComponentQuery selector. Parameters:
selector

: String

Contain er

An Ext.ComponentQuery selector Returns:


Ext.Component

clearListeners() : void Removes all listeners for this object including the managed listeners Removes all listeners for this object including the managed listeners Parameters:

Observa ble

None.

Returns:

void

clearManagedListeners() : void Removes all managed listeners for this object. Removes all managed listeners for this object. Parameters:

None.

Observa ble

Returns:

void

destroy() : void Destroys the Component. Destroys the Component. Parameters:

None.

Compon ent

Returns:

void

disable() : Ext.form.FormPanel A convenient method to disable all fields in this forms A convenient method to disable all fields in this forms Parameters:

None.

FormPa nel

Returns:
Ext.form.FormPanel

this This form doComponentLayout() : Ext.Container This method needs to be called whenever you change something on this component that requires the components layout to... Compon This method needs to be called whenever you change something on this component that ent 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:

None.

Returns:
Ext.Container

this doLayout() : Ext.Container Force this container's layout to be recalculated. A call to this function is required after adding a new component to... Force this container's layout to be recalculated. A call to this function is required after adding a new component to an already rendered container, or possibly after changing sizing/position properties of child components. Parameters:

None.

Contain er

Returns:
Ext.Container

this down( String selector ) : Ext.Component Retrieves the first descendant of this container which matches the passed selector. The passed in selector must compl... Retrieves the first descendant of this container which matches the passed selector. The passed in selector must comply with an Ext.ComponentQuery selector. Parameters:
selector

: String

Contain er

An Ext.ComponentQuery selector Returns:


Ext.Component

enable() : Ext.form.FormPanel A convenient method to enable all fields in this forms A convenient method to enable all fields in this forms Parameters:

FormPa nel

None.

Returns:

Ext.form.FormPanel

this This form enableBubble( String/Array events ) : void Enables 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.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'); } } });

Observa ble

Parameters:
events

: String/Array

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

void

fireEvent( String eventName, Object... args ) : Boolean Fires 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:
eventName

: String

Observa ble

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. getActiveItem() : activeItem Returns the current activeItem for the layout (only for a card layout) Returns the current activeItem for the layout (only for a card layout) Parameters:

None.

Contain er

Returns:
activeItem

activeItem Current active component 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:

Compon ent

None.

Returns:
Ext.Container

the Container which owns this Component. getComponent( String/Number comp ) : Ext.Component Attempts a default component lookup (see Ext.Container.getComponent). If the component is not found in the normal ite... Attempts a default component lookup (see Ext.Container.getComponent). If the component is not found in the normal items, the dockedItems are searched and the matched component (if any) returned (see {@loink #getDockedComponent}). Parameters:
comp

: String/Number

Panel

The docked component id or itemId to find Returns:


Ext.Component

The docked component, if found getDockedComponent( String/Number comp ) : Ext.Component Finds a docked component by id, itemId or position Finds a docked component by id, itemId or position Parameters:
comp

: String/Number Panel

The id, itemId or position of the child component (see getComponent for details) Returns:
Ext.Component

The component (if found) getDockedItems() : Array Retrieve an array of all currently docked components. Retrieve an array of all currently docked components. Parameters:

Panel

None.

Returns:

Array

An array of components. getEl() : void Retrieves the top level element representing this component. Retrieves the top level element representing this component. Parameters:

None.

Compon ent

Returns:

void

getHeight() : Number Gets the current height of the component's underlying element. Gets the current height of the component's underlying element. Parameters:

None.

Compon ent

Returns:
Number

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:

None.

Compon ent

Returns:

void

getInsertPosition( String/Number/Element/HTMLElement position ) : HTMLElement This 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:
position

Compon ent

: 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 getLayout() : Ext.layout.ContainerLayout Returns the layout instance currently associated with this Container. If a layout has not been instantiated yet, that... Returns the layout instance currently associated with this Container. If a layout has not been instantiated yet, that is done first Parameters:

None.

Contain er

Returns:
Ext.layout.ContainerLayout

The layout getRecord() : Ext.data.Model Returns the Model instance currently loaded into this form (if any) Returns the Model instance currently loaded into this form (if any) Parameters:

None.

FormPa nel

Returns:
Ext.data.Model

The Model instance getSize() : Object Gets the current size of the component's underlying element. Gets the current size of the component's underlying element. Parameters:

None.

Returns:
Object

Compon ent

An object containing the element's size {width: (element width), height: (element height)} getValues( Boolean enabled ) : Object Returns an object containing the value of each field in the form, keyed to the field's name. For groups of checkbox ... Returns an object containing the value of each field in the form, keyed to the field's name.

FormPa nel

For groups of checkbox fields with the same name, it will be arrays of values. For examples:
{ name: "Jacky Nguyen", // From a TextField favorites: [ 'pizza', 'noodle', 'cake' ] }

Parameters:
enabled true

: Boolean

to return only enabled fields

Returns:
Object

Object mapping field name to its value getWidth() : Number Gets the current width of the component's underlying element. Gets the current width of the component's underlying element. Parameters:

None.

Compon ent

Returns:
Number

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. Compon ent Example usage:
var t = new Ext.form.Text(); alert(t.getXTypes()); // alerts 'component/field/textfield'

Parameters:

None.

Returns:

String

The xtype hierarchy string hasListener( String eventName ) : Boolean Checks 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:
eventName

: String Observa ble

The name of the event to check for Returns:


Boolean

True if the event is being listened for, else false hide( [Object/String/Boolean animation] ) : void Hide the component Hide the component Parameters:
animation

: Object/String/Boolean

(optional) Defaults to false. Returns:

Compon ent

void

hideMask() : Ext.form.FormPanel Hides a previously shown wait mask (See showMask) Hides a previously shown wait mask (See showMask) Parameters:

None.

FormPa nel

Returns:
Ext.form.FormPanel

this insert( Number index, Ext.Component component ) : Ext.Component Inserts a Component into this Container at a specified index. Fires the beforeadd event before Contain inserting, then fires ... er Inserts a Component into this Container at a specified index. Fires the beforeadd event before inserting, then fires the add event after the Component has been inserted.

Parameters:
index

: Number

The index at which the Component will be inserted into the Container's items collection
component

: Ext.Component

The child Component to insert. Ext uses lazy rendering, and will only render the inserted Component should it become necessary. A Component config object may be passed in order to avoid the overhead of constructing a real Component object if lazy rendering might mean that the inserted Component will not be rendered immediately. To take advantage of this 'lazy instantiation', set the Ext.Component.xtype config property to the registered type of the Component wanted. For a list of all available xtypes, see Ext.Component. Returns:
Ext.Component

component The Component (or config object) that was inserted with the Container's default config values applied. insertDocked( Number pos, Object/Array component. ) : void Inserts docked item(s) to the panel at the indicated position. Inserts docked item(s) to the panel at the indicated position. Parameters:
pos

: Number

The index at which the Component will be inserted


component.

: Object/Array

Panel

The Component or array of components to add. The components must include a 'dock' paramater on each component to indicate where it should be docked ('top', 'right', 'bottom', 'left'). Returns:

void Compon

isDisabled() : Boolean

Method to determine whether this Component is currently disabled. Method to determine whether this Component is currently disabled. Parameters:

ent

None.

Returns:
Boolean

the disabled state of this Component. isDraggable() : Boolean Method to determine whether this Component is draggable. Method to determine whether this Component is draggable. Parameters:

None.

Compon ent

Returns:
Boolean

the draggable state of this component. isDroppable() : Boolean Method to determine whether this Component is droppable. Method to determine whether this Component is droppable. Parameters:

None.

Compon ent

Returns:
Boolean

the droppable state of this component. isFloating() : Boolean Method to determine whether this Component is floating. Method to determine whether this Component is floating. Parameters:

None.

Compon ent

Returns:
Boolean

the floating state of this component. isHidden() : Boolean

Compon

Method to determine whether this Component is currently set to hidden. Method to determine whether this Component is currently set to hidden. Parameters:

ent

None.

Returns:
Boolean

the hidden state of this Component. isVisible() : Boolean Returns true if this component is visible. Returns true if this component is visible. Parameters:

None.

Compon ent

Returns:
Boolean

True if this component is visible, false otherwise. isXType( String xtype, [Boolean shallow] ) : Boolean Tests 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:
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

Compon ent

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. load( Ext.data.Model instance ) : Ext.form.FormPanel (Shortcut to loadRecord method) Loads matching fields from a model instance into this form (Shortcut to loadRecord method) Loads matching fields from a model instance into this form Parameters:
instance

: Ext.data.Model FormPa nel

The model instance Returns:


Ext.form.FormPanel

this loadRecord( Ext.data.Model instance ) : Ext.form.FormPanel Loads matching fields from a model instance into this form Loads matching fields from a model instance into this form Parameters:
instance

: Ext.data.Model FormPa nel

The model instance Returns:


Ext.form.FormPanel

this nextSibling( selector Optional. ) : void Returns the next sibling of this Component. Optionally selects the next sibling which matches the passed ComponentQue... Compon ent 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() Parameters:
Optional.

: selector

A ComponentQuery selector to filter the following items. Returns:

void

on( String eventName, Function handler, [Object scope], [Object options] ) : void Appends an event handler to this object (shorthand for addListener.) Appends an event handler to this object (shorthand for addListener.) Parameters:
eventName

: String

The type of event to listen for


handler

: Function

The method the event invokes


scope

: Object

Observa ble

(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. Returns:

void

previousSibling( selector Optional. ) : void Returns the previous sibling of this Component. Optionally selects the previous sibling which matches the passed Comp... Returns the previous sibling of this Component. Optionally selects the previous sibling which matches the passed ComponentQuery selector. Compon ent

May also be refered to as prev() Parameters:


Optional.

: selector

A ComponentQuery selector to filter the preceding items. Returns:

void

query( String selector ) : Array Retrieves all descendant components which match the passed selector. Executes an Ext.ComponentQuery.query using this ... Retrieves all descendant components which match the passed selector. Executes an Ext.ComponentQuery.query using this container as its root. Parameters:
selector

: String

Contain er

Selector complying to an Ext.ComponentQuery selector Returns:


Array

Ext.Component's which matched the selector relayEvents( Object o, Array events ) : void Relays 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:
o

: Object Observa ble

The Observable whose events this object is to relay.


events

: Array

Array of event names to relay. Returns:

void Contain er

remove( Component/String component, [Boolean autoDestroy] ) : Ext.Component Removes a component from this container. Fires the beforeremove event before removing, then fires the remove event a...

Removes a component from this container. Fires the beforeremove event before removing, then fires the remove event after the component has been removed. Parameters:
component

: Component/String

The component reference or id to remove.


autoDestroy

: Boolean

(optional) True to automatically invoke the removed Component's Ext.Component.destroy function. Defaults to the value of this Container's autoDestroy config. Returns:
Ext.Component

component The Component that was removed. removeAll( [Boolean autoDestroy] ) : Array Removes all components from this container. Removes all components from this container. Parameters:
autoDestroy

: Boolean

Contain (optional) True to automatically invoke the removed Component's Ext.Component.destroy function. Defaults to the value of this Container's autoDestroy er config. Returns:
Array

Array of the destroyed components 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:

None.

Compon ent

Returns:

void Panel

removeDocked( Ext.Component item., [Boolean autoDestroy] ) : void Removes the docked item from the panel.

Removes the docked item from the panel. Parameters:


item.

: Ext.Component

The Component to remove.


autoDestroy

: Boolean

(optional) Destroy the component after removal. Returns:

void

removeListener( String eventName, Function handler, [Object scope] ) : void Removes an event handler. Removes an event handler. Parameters:
eventName

: String

The type of event the handler was associated with.


handler

: Function Observa ble

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. Returns:

void

removeManagedListener( Observable|Element item, Object|String ename, Function fn, Object scope ) : void Removes listeners that were added by the mon method. Removes listeners that were added by the mon method. Observa Parameters: ble 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 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:

void

reset() : Ext.form.FormPanel Resets all fields in the form back to their original values Resets all fields in the form back to their original values Parameters:

None.

FormPa nel

Returns:
Ext.form.FormPanel

this This form 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. Observa Parameters: ble None. Returns:

void

setActiveItem( Ext.Component/Number/Object card, [String/Object cardSwitchAnim ation] ) : Ext.Container Contain Allows you to set the active card in this container. This method is only available if the er container uses a CardLayout... Allows you to set the active card in this container. This method is only available if the

container uses a CardLayout. Note that a Carousel and TabPanel both get a CardLayout automatically, so both of those components are able to use this method. Parameters:
card

: Ext.Component/Number/Object

The card you want to be made active. A number is interpreted as a card index. An object will be converted to a Component using the objects xtype property, then added to the container and made active. Passing a Component will make sure the component is a child of this container, and then make it active.
cardSwitchAnimation

: String/Object

(optional) The cardSwitchAnimation used to switch between the cards. This can be an animation type string or an animation configuration object. Returns:
Ext.Container

this setCentered( Boolean centered ) : void Show 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:
centered

: Boolean

Compon ent

True to center, false to remove centering Returns:

void

setDisabled( Boolean disabled ) : void Enable or disable the component. Enable or disable the component. Parameters:
disabled

: Boolean

Compon ent

Returns:

void Compon

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:

ent

None.

Returns:
Component

this setDraggable( Boolean/Mixed draggable, Boolean autoShow ) : void Sets a Component as draggable. Sets a Component as draggable. Parameters:
draggable

: Boolean/Mixed Compon ent

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

Returns:

void

setFloating( Boolean floating, Boolean autoShow ) : void Sets a Component as floating. Sets a Component as floating. Parameters:
floating autoShow

: Boolean : Boolean

Compon ent

Returns:

void

setHeight( Number height ) : Ext.Component Sets the height of the component. This method fires the resize event. Sets the height of the component. This method fires the resize event. Parameters:

Compon ent

height

: Number

The new height to set. This may be one of:


o o o

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 setLoading( Boolean/Object load, Boolean targetEl ) : Ext.LoadMask This 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:
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

Compon ent

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. setOrientation( String orientation, Number/String width, Number/String height ) : void Sets the orientation for the Panel. Sets the orientation for the Panel. Parameters:
orientation

: String

Compon ent

'landscape' or 'portrait'
width

: Number/String

New width of the Panel.


height

: Number/String

New height of the Panel. Returns:

void

setPosition( Number left, Number top ) : Ext.Component Sets 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:
left

: Number Compon ent

The new left


top

: Number

The new top Returns:


Ext.Component

this setScrollable( Mixed config ) : void Sets a Component as scrollable. Sets a Component as scrollable. Parameters:
config

: Mixed Compon ent

Acceptable values are a Ext.Scroller configuration, 'horizontal', 'vertical', 'both', and false Returns:

void

setSize( Mixed width, Mixed height ) : Ext.Component Sets the width and height of this Component. This method fires the resize event. This method Compon ent 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:
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). o A String used to set the CSS width style. o A size object in the format {width: widthValue, height: heightValue}. o undefined to 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:
o o o o

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. undefined to leave the height unchanged.

Returns:
Ext.Component

this setValues( Object values ) : Ext.form.FormPanel Sets the values of form fields in bulk. Example usage: myForm.setValues({ name: 'Ed', crazy: true, userna... Sets the values of form fields in bulk. Example usage:
myForm.setValues({ name: 'Ed', crazy: true, username: 'edspencer' });

If there groups of checkbox fields with the same name, pass their values in an array. For example:
myForm.setValues({ name: 'Jacky', crazy: false, hobbies: [ 'reading', 'cooking', 'gaming' ] });

FormPa nel

Parameters:

values

: Object

field name => value mapping object Returns:


Ext.form.FormPanel

this setVisible( Boolean visible ) : Ext.Component Convenience function to hide or show this component by boolean. Convenience function to hide or show this component by boolean. Parameters:
visible

: Boolean Compon ent

True to show, false to hide Returns:


Ext.Component

this setWidth( Number width ) : Ext.Component Sets the width of the component. This method fires the resize event. Sets the width of the component. This method fires the resize event. Parameters:
width

: Number

The new width to setThis may be one of:


o o

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.

Compon ent

Returns:
Ext.Component

this show( [Object/String/Boolean animation] ) : void Show the component. Show the component. Parameters:

Compon ent

animation

: Object/String/Boolean

(optional) Defaults to false. Returns:

void

showBy( Mixed alignTo, Object/String/Boolean animation, Boolean allowOnSide ) : void Show this component relative another component or element. Show this component relative another component or element. Parameters:
alignTo

: Mixed Compon ent

Element or Component
animation : Object/String/Boolean allowOnSide : Boolean

true to allow this element to be aligned on the left or right. Returns:

void

showMask( String/Object cfg, String/Element target ) : Ext.form.FormPanel Shows a generic/custom mask over a designated Element. Shows a generic/custom mask over a designated Element. Parameters:
cfg

: String/Object

Either a string message or a configuration object supporting the following options:


{ message transparent target cls customImageUrl } : : : : : 'Please Wait', false, Ext.getBody(), 'form-mask', 'trident.jpg' //optional target Element

FormPa nel

This object is passed to the waitTpl for use with a custom masking implementation.
target

: String/Element

The target Element instance or Element id to use as the masking agent for the operation (defaults the container Element of the component) Returns:
Ext.form.FormPanel

this submit( Object options ) : Ext.data.Connection Performs a Ajax-based submission of form values (if standardSubmit is false) or otherwise executes a standard HTML F... Performs a Ajax-based submission of form values (if standardSubmit is false) or otherwise executes a standard HTML Form submit action. Parameters:
options

: Object

Unless otherwise noted, options may include the following:


o

url : String The url for the action (defaults to the form's url.)

method : String The form method to use (defaults to the form's method, or POST if not defined)

params : String/Object The params to pass (defaults to the FormPanel's baseParams, or none if not defined) Parameters are encoded as standard HTTP parameters using Ext.urlEncode.

FormPa nel

headers : Object Request headers to set for the action (defaults to the form's default headers)

autoAbort : Boolean
true

to abort any pending Ajax request prior to submission (defaults to false) Note: Has no effect when standardSubmit is enabled.
o

submitDisabled : Boolean
true

to submit all fields regardless of disabled state (defaults to false) Note: Has no effect when standardSubmit is enabled.

waitMsg : String/Config If specified, the value is applied to the waitTpl if defined, and rendered to the waitMsgTarget prior to a Form submit action.

success : Function The callback that will be invoked after a successful response. A response is successful if a response is received from the server and is a JSON object where the success property is set to true, {"success": true} The function is passed the following parameters: form : Ext.FormPanel The form that requested the action result : The result object returned by the server as a result of the submit request. failure : Function The callback that will be invoked after a failed transaction attempt. The function is passed the following parameters: form : The Ext.FormPanel that requested the submit. result : The failed response or result object returned by the server which performed the operation. scope : Object The scope in which to call the callback functions (The this reference for the callback functions).

Returns:
Ext.data.Connection

request Object suspendEvents( Boolean queueSuspended ) : void Suspend the firing of all events. (see resumeEvents) Suspend the firing of all events. (see resumeEvents) Parameters:
queueSuspended

: Boolean Observa ble

Pass as true to queue up suspended events to be fired after the resumeEvents call instead of discarding all suspended events; Returns:

void Observa

un( String eventName, Function handler, [Object scope] ) : void

Removes an event handler (shorthand for removeListener.) Removes an event handler (shorthand for removeListener.) Parameters:
eventName

ble

: 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. Returns:

void

up( String selector ) : Ext.Container Walks up the ownerCt axis looking for an ancestor Container which matches the passed simple selector. Example:var own... Walks up the ownerCt axis looking for an ancestor Container which matches the passed simple selector. Example:
var owningTabContainer = grid.up('tabcontainer');

Parameters:
selector

Compon ent : String

Optional. The simple selector to test. Returns:


Ext.Container

The matching ancestor Container (or <code>undefined</code> if no match was found). update( Mixed htmlOrData, [Boolean loadScripts], [Function callback] ) : void Update the content area of a component. Update the content area of a component. Parameters:

Compon ent

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

void

updateRecord( Ext.data.Model instance, Boolean enabled ) : Ext.form.FormPanel Updates a model instance with the current values of this form Updates a model instance with the current values of this form Parameters:
instance

: Ext.data.Model

The model instance


enabled true

: Boolean

FormPa nel

to update the Model with values from enabled fields only

Returns:
Ext.form.FormPanel

this

Public Events
Event activate : ( Ext.Component this ) Fires after a Component has been visually activated. Fires after a Component has been visually activated. Defined By Compon ent

Listeners will be called with the following arguments:


this

: Ext.Component

add : ( Ext.Container this, Ext.Component component, Number index ) Listeners will be called with the following arguments:
this : Ext.Container component : Ext.Component

The component that was added


index

Containe r

: Number

The index at which the component was added to the container's items collection 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:
this : Ext.Component container : Ext.Container

Compon ent

Parent Container
pos

: Number

position of Component afterlayout : ( Ext.Container this, ContainerLayout layout ) Fires when the components in this container are arranged by the associated layout manager. Fires when the components in this container are arranged by the associated layout manager. Listeners will be called with the following arguments:
this : Ext.Container layout : ContainerLayout

Containe r

The ContainerLayout implementation for this container 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: Compon ent

this

: Ext.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 Compon can prevent the activate from occurring. ent Listeners will be called with the following arguments:
this

: Ext.Component

beforeadd : ( Ext.Container this, Ext.Component component, Number index ) Fires before any Ext.Component is added or inserted into the container. A handler can return false to cancel the add. Fires before any Ext.Component is added or inserted into the container. A handler can return false to cancel the add. Listeners will be called with the following arguments:
this : Ext.Container component : Ext.Component

Containe r

The component being added


index

: Number

The index at which the component will be added to the container's items collection beforecardswitch : ( Ext.Container this, Ext.Component newCard, Ext.Component oldCard, Number ind ex, Boolean animated ) Fires before this container switches the active card. This event is only available if this container uses a CardLayou... Fires before this container switches the active card. This event is only available if this container uses a CardLayout. Note that TabPanel and Carousel both get a CardLayout by default, so both will have this event. A handler can return false to cancel the card switch. Listeners will be called with the following arguments:
this : Ext.Container newCard : Ext.Component

Containe r

The card that will be switched to


oldCard

: Ext.Component

The card that will be switched from


index

: Number

The index of the card that will be switched to


animated

: Boolean

True if this cardswitch will be animated 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:
this

Compon ent

: Ext.Component

beforedestroy : ( Ext.Component this ) Fires before the component is destroyed. Return false from an event handler to stop the destroy. Fires before the component is destroyed. Return false from an event handler to stop the destroy. Listeners will be called with the following arguments:
this

Compon ent

: Ext.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:
this

Compon ent

: Ext.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:
this : Ext.Panel orientation : String

Compon ent

'landscape' or 'portrait'
width : Number height : Number

beforeremove : ( Ext.Container this, Ext.Component component ) Fires before any Ext.Component is removed from the container. A handler can return false to cancel the remove. Fires before any Ext.Component is removed from the container. A handler can return false to cancel the remove. Containe Listeners will be called with the following arguments: r
this : Ext.Container component : Ext.Component

The component being removed beforerender : ( Ext.Component this ) Fires before the component is rendered. Return false from an event handler to stop the render. Fires before the component is rendered. Return false from an event handler to stop the render. Listeners will be called with the following arguments:
this

Compon ent

: Ext.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:
this

Compon ent

: Ext.Component

beforesubmit : ( Ext.FormPanel this, Object values, Object options ) Fires immediately preceding any Form submit action. Implementations may adjust submitted form values or options prior... Fires immediately preceding any Form submit action. Implementations may adjust submitted form values or options prior to execution. A return value of false from this listener will abort the submission attempt (regardless of standardSubmit configuration) Listeners will be called with the following arguments:
this

: Ext.FormPanel

This FormPanel
values

FormPan el

: Object

A hash collection of the qualified form values about to be submitted


options

: Object

Submission options hash (only available when standardSubmit is false)

bodyresize : ( Ext.Panel p, Number width, Number height ) Fires after the Panel has been resized. Fires after the Panel has been resized. Listeners will be called with the following arguments:
p

: Ext.Panel Panel

the Panel which has been resized.


width

: Number

The Panel body's new width.


height

: Number

The Panel body's new height. cardswitch : ( Ext.Container this, Ext.Component newCard, Ext.Component oldCard, Number ind ex, Boolean animated ) Fires after this container switches the active card. If the card is switched using an animation, this event will fire... Fires after this container switches the active card. If the card is switched using an animation, this event will fire after the animation has finished. This event is only available if this container uses a CardLayout. Note that TabPanel and Carousel both get a CardLayout by default, so both will have this event. Listeners will be called with the following arguments:
this : Ext.Container newCard : Ext.Component

The card that has been switched to


oldCard

Containe r

: Ext.Component

The card that has been switched from


index

: Number

The index of the card that has been switched to


animated

: Boolean

True if this cardswitch was animated 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:

Compon ent

this

: Ext.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:
this

Compon ent

: Ext.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:
this

Compon ent

: Ext.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:
this

Compon ent

: Ext.Component

exception : ( Ext.FormPanel this, Object result ) Fires when either the Ajax HTTP request reports a failure OR the server returns a success:false response in the resul... Fires when either the Ajax HTTP request reports a failure OR the server returns a success:false response in the result payload. Listeners will be called with the following arguments:
this

: Ext.FormPanel

FormPan el

This FormPanel
result

: Object

Either a failed Ext.data.Connection request object or a failed (logical) server response payload. hide : ( Ext.Component this ) Fires after the component is hidden. Fires after the component is hidden when calling the Compon hide method. ent 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:

this

: Ext.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:
this : Ext.Component x : Number

Compon ent

The new x position


y

: Number

The new y position 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:
this : Ext.Panel orientation : String

Compon ent

'landscape' or 'portrait'
width : Number height : Number

remove : ( Ext.Container this, Ext.Component component ) Listeners will be called with the following arguments:
this : Ext.Container component : Ext.Component

Containe r

The component that was removed 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:
this : Ext.Component ownerCt : Ext.Container

Compon ent

Container which holds the component render : ( Ext.Component this )

Compon

Fires after the component markup is rendered. Fires after the component markup is rendered. Listeners will be called with the following arguments:
this

ent

: Ext.Component

resize : ( Ext.Component this, Number adjWidth, Number adjHeight, Number rawWidth, Numbe r rawHeight ) Fires after the component is resized. Fires after the component is resized. Listeners will be called with the following arguments:
this : Ext.Component adjWidth : Number

The box-adjusted width that was set


adjHeight

: Number

Compon ent

The box-adjusted height that was set


rawWidth

: Number

The width that was originally specified


rawHeight

: Number

The height that was originally specified 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:
this

Compon ent

: Ext.Component

submit : ( Ext.FormPanel this, Object result ) Fires upon successful (Ajax-based) form submission Fires upon successful (Ajax-based) form submission Listeners will be called with the following arguments:
this

: Ext.FormPanel

FormPan el

This FormPanel
result

: Object

The result object as returned by the server

.FormPanel
Package: Ext.form Defined In: FormPanel.js Class: FormPanel Extends: Panel Simple form panel which enables easy getting and setting of field values. Can load model instances. Example usage:
var form = new Ext.form.FormPanel({ items: [ { xtype: 'textfield', name : 'first', label: 'First name' }, { xtype: 'textfield', name : 'last', label: 'Last name' }, { xtype: 'numberfield', name : 'age', label: 'Age' }, { xtype: 'urlfield', name : 'url', label: 'Website' } ] });

Loading model instances:


Ext.regModel('User', { fields: [ {name: 'first', {name: 'last', {name: 'age', {name: 'url', ] });

type: type: type: type:

'string'}, 'string'}, 'int'}, 'string'}

var user = Ext.ModelMgr.create({ first: 'Ed', last : 'Spencer', age : 24, url : 'http://extjs.com' }, 'User'); form.load(user);

Config Options
Config Options Defined By

activeItem : String/Number A string component id or the numeric index of the component that should be initially activated within the container's... A string component id or the numeric index of the component that should be initially Container activated within the container's layout on render. For example, activeItem: 'item-1' or activeItem: 0 (index 0 = the first item in the container's collection). activeItem only applies to layout styles that can display items one at a time (like Ext.layout.CardLayout and Ext.layout.FitLayout). Related to Ext.layout.ContainerLayout.activeItem. autoDestroy : Boolean If true the container will automatically destroy any contained component that is removed from it, else destruction mu... Container If true the container will automatically destroy any contained component that is removed from it, else destruction must be handled manually (defaults to true). baseCls : String Panel The base CSS class to apply to this panel's element (defaults to 'x-panel'). baseParams : Object Optional hash of params to be sent (when standardSubmit configuration is false) on every FormPanel submit. bodyBorder : Number/Boolean A shortcut for setting a border style on the body element. The value can either be a number to be applied to all side... Panel A shortcut for setting a border style on the body element. The value can either be a number to be applied to all sides, or a normal css string describing borders. Defaults to undefined. bodyMargin : Number/Boolean A shortcut for setting a margin style on the body element. The value can either be a number to be applied to all side... Panel A shortcut for setting a margin style on the body element. The value can either be a number to be applied to all sides, or a normal css string describing margins. Defaults to undefined. bodyPadding : Number/Boolean A shortcut for setting a padding style on the body element. The value can either be a number to be applied to all sid... Panel A shortcut for setting a padding style on the body element. The value can either be a number to be applied to all sides, or a normal css string describing padding. Defaults to undefined. 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 ... Component 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'. bubbleEvents : Array Container An array of events that, when fired, should be bubbled to any parent container. See

Ext.util.Observable.enableBubble.... An array of events that, when fired, should be bubbled to any parent container. See Ext.util.Observable.enableBubble. Defaults to ['add', 'remove']. cardSwitchAnimation : String/Mixed Animation to be used during transitions of cards. Note this only works when this container has a CardLayout. Any vali... Container Animation to be used during transitions of cards. Note this only works when this container has a CardLayout. Any valid value from Ext.anims can be used ('fade', 'slide', 'flip', 'cube', 'pop', 'wipe'). Defaults to null. centered : Boolean Component Center the Component. Defaults to false. cls : String An optional extra CSS class that will be added to this component's Element (defaults to ''). This can be useful for ... Component 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. componentCls : String CSS Class to be added to a components root level element to give distinction to it via Component styling. 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 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. 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 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.

Component

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 layout scheme that the Component may use. It is just HTML. Layouts operate on child items. Add either the x-hidden or the x-hide-display CSS class to prevent a brief flicker of the content before it is rendered to the panel. data : Mixed The initial set of data to apply to the tpl to update the content area of the Component. defaultType : String The default xtype of child Components to create in this Container when a child item is specified as a raw configurati... The default xtype of child Components to create in this Container when a child item is specified as a raw configuration object, rather than as an instantiated Component. Defaults to 'panel'. defaults : Object|Function This option is a means of applying default settings to all added items whether added through the items config or via ... This option is a means of applying default settings to all added items whether added through the items config or via the add or insert methods. If an added item is a config object, and not an instantiated Component, then the default properties are unconditionally applied. If the added item is an instantiated Component, then the default properties are applied conditionally so as not to override existing properties in the item. If the defaults option is specified as a function, then the function will be called using this Container as the scope (this reference) and passing the added item as the first parameter. Any resulting object from that call is then applied to the item as default properties. For example, to automatically apply padding to the body of each of a set of contained Ext.Panel items, you could pass: defaults: {bodyStyle:'padding:15px'}. Usage:
defaults: { container autoScroll:true }, items: [ { xtype: 'panel', id: 'panel1', autoScroll: false autoScroll:false }, // defaults are applied to items, not the

Component

Container

Container

// defaults do not have precedence over // options in config objects, so the defaults // will not be applied here, panel1 will be

new Ext.Panel({ // defaults do have precedence over options id: 'panel2', // options in components, so the defaults autoScroll: false // will be applied here, panel2 will be autoScroll:true. }) ]

disabled : Boolean Defaults to false. disabledCls : String CSS class to add when the Component is disabled. Defaults to 'x-item-disabled'. dockedItems : Object/Array A component or series of components to be added as docked items to this panel. The docked items can be docked to eith... A component or series of components to be added as docked items to this panel. The docked items can be docked to either the top, right, left or bottom of a panel. This is typically used for things like toolbars or tab bars:
var panel = new Ext.Panel({ fullscreen: true, dockedItems: [{ xtype: 'toolbar', dock: 'top', items: [{ text: 'Docked to the bottom' }] }] });

Component Component

Panel

draggable : Boolean Allows the component to be dragged via the touch event. floating : Boolean Create the Component as a floating and use absolute positioning. Defaults to false. floatingCls : Boolean The class that is being added to this component when its floating. (defaults to x-floating) fullscreen : Boolean Force the component to take up 100% width and height available. Defaults to false. Setting this configuration immedia... 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. height : Number The height of this component in pixels. hidden : Boolean Defaults to false. 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. html : String/Object An HTML fragment, or a DomHelper specification to use as the layout element content (defaults to ''). The HTML conten...

Component Component Component

Component

Component Component

Component

Component

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. items : Object/Array ** IMPORTANT: be sure to specify a layout if needed ! ** A single item, or an array of child Components to be added t...
** IMPORTANT: be sure to specify a layout if needed ! **

A single item, or an array of child Components to be added to this container, for example:
// specifying a single item items: {...}, layout: 'fit', // specify a layout! // specifying multiple items items: [{...}, {...}], layout: 'hbox', // specify a layout!

Each item may be:


any type of object based on Ext.Component a fully instanciated object or Container an object literal that: o has a specified xtype o the Ext.Component.xtype specified is associated with the Component desired and should be chosen from one of the available xtypes as listed in Ext.Component. o If an xtype is not explicitly specified, the defaultType for that Container is used. o will be "lazily instanciated", avoiding the overhead of constructing a fully instanciated Component object

Notes:

Ext uses lazy rendering. Child Components will only be rendered should it become necessary. Items are automatically laid out when they are first shown (no sizing is done while hidden), or in response to a doLayout call. Do not specify contentEl/ html with items.

layout : String/Object *Important: In order for child items to be correctly sized and positioned, typically a layout manager must be specifi... *Important: In order for child items to be correctly sized and positioned, typically a layout manager must be specified through the layout configuration option. Container

The sizing and positioning of child items is the responsibility of the Container's layout

manager which creates and manages the type of layout you have in mind. For example: If the layout configuration is not explicitly specified for a general purpose container (e.g. Container or Panel) the default layout manager will be used which does nothing but render child components sequentially into the Container (no sizing or positioning will be performed in this situation).

layout

may be specified as either as an Object or as a String: Specify as an Object o Example usage:


layout: { type: 'vbox', align: 'left' } o type

The layout type to be used for this container. If not specified, a default Ext.layout.ContainerLayout will be created and used.

Valid layout type values are:


o auto card fit hbox vbox

Default

Layout specific configuration properties

Additional layout specific configuration properties may also be specified. For complete details regarding the valid config options for each layout type, see the layout class corresponding to the type specified.

Specify as a String o Example usage:


layout: { type: 'vbox', padding: '5', align: 'left' }

layout

The layout type to be used for this container (see list of valid layout type values above).

Additional layout specific configuration properties. For complete details regarding the valid config options for each layout type, see the layout class corresponding to the layout specified. layoutOnOrientationChange : Boolean Set this to true to automatically relayout this component on orientation change. This property is set to true by defa... Set this to true to automatically relayout this component on orientation change. This Component 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 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

Observable 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'); } } } });

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 ... Component 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'. maxHeight : Number The maximum value in pixels which this Component will set its height to. Warning: This will override any size managem... Component The maximum value in pixels which this Component will set its height to. Warning: This will override any size management applied by layout managers. maxWidth : Number The maximum value in pixels which this Component will set its width to. Warning: This will override any size manageme... Component The maximum value in pixels which this Component will set its width to. Warning: This will override any size management applied by layout managers. minHeight : Number The minimum value in pixels which this Component will set its height to. Warning: This will override any size managem... Component The minimum value in pixels which this Component will set its height to. Warning: This will override any size management applied by layout managers. minWidth : Number The minimum value in pixels which this Component will set its width to. Warning: This will override any size manageme... Component The minimum value in pixels which this Component will set its width to. Warning: This will override any size management applied by layout managers. modal : Boolean True to make the Component modal and mask everything behind it when displayed, false to display it without restrictin... Component 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).

monitorOrientation : Boolean Component Monitor Orientation change 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... Component 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'. 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 Component 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. renderSelectors. : Object An object containing properties specifying DomQuery selectors which identify child elements created by the render pro... 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:

Component

renderTpl: ' "{imageUrl}" class="x-image-component-img"> "x-image-component-desc">{description} ', 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. renderTo : Mixed Specify the id of the element, a DOM element or an existing Element that this component will be rendered into. Notes ... Component 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. renderTpl : Mixed An XTemplate used to create the internal structure inside this Component's encapsulating Element. You do not normally... 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 Component 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. scroll : Mixed Configure the component to be scrollable. Acceptable values are: 'horizontal', 'vertical', 'both' to enabling scroll... 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.

Component

Enabling scrolling immediately sets the monitorOrientation config to true (for Panel) 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... Component 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. standardSubmit : Boolean FormPanel Wether or not we want to perform a standard form submit. Defaults to false stopMaskTapEvent : Boolean Component True to stop the event that fires when you click outside the floating component. Defalts to

true. 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.
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' } }) ] });

Component

styleHtmlCls : String The class that is added to the content target when you set styleHtmlContent to true. Defaults to 'x-html' 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. submitOnAction : Object When this is set to true, the form will automatically submit itself whenever the 'action' event fires on a field in t... When this is set to true, the form will automatically submit itself whenever the 'action' event fires on a field in this form. The action event usually fires whenever you press go or enter inside a textfield. 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 Ext.Template, Ext.XTemplate or an array of strings to form an Ext.XTemplate. Used in conjunction with the data and tplWriteMode configurations. 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). ui : String

Component

Component

FormPanel

Component

Component

Component

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 '-'.
new Ext.Panel({ title: 'Some Title', baseCls: 'x-component' ui: 'green' });

The ui configuration in this example would add 'x-component-green' as an additional class. url : String The default Url for submit actions waitTpl : Object The defined waitMsg template. Used for precise control over the masking agent used to mask the FormPanel (or other E... The defined waitMsg template. Used for precise control over the masking agent used to mask the FormPanel (or other Element) during form Ajax/submission actions. For more options, see showMask method. width : Number The width of this component in pixels.

FormPanel

FormPanel

Component

Public Properties
Property Defined By draggable : Boolean Component Read-only property indicating whether or not the component can be dragged items : Ext.util.MixedCollection Container The MixedCollection containing all the child items of this container. record : Ext.data.Model FormPanel The Model instance currently loaded into this form (if any). Read only rendered : Boolean Component Read-only property indicating whether or not the component has been rendered.

Public Methods
Method add( ...Object/Array component ) : Ext.Component/Array Adds Component(s) to this Container. Description : <ul class="mdetail-params"> Fires the beforeadd event before addin... Adds Component(s) to this Container. Defined By

Contain er

Description :

Fires the beforeadd event before adding The Container's default config values will be applied accordingly (see defaults for details). Fires the add event after the component has been added.

Notes :

If the Container is already rendered when add is called, you may need to call 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. For example:
var tb = new Ext.Toolbar(); tb.render(document.body); // toolbar is rendered tb.add({text:'Button 1'}); // add multiple items (defaultType for Toolbar is 'button') tb.add({text:'Button 2'}); tb.doLayout(); // refresh the layout

Warning: Containers directly managed by the BorderLayout layout manager may not be removed or added. See the Notes for BorderLayout for more details.

Parameters:
component

: ...Object/Array

Either one or more Components to add or an Array of Components to add. See items for additional information. Returns:
Ext.Component/Array

The Components that were added. 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:

None.

Compon ent

Returns:

void

addDocked( Object/Array component., [Number pos] ) : void Adds docked item(s) to the panel. Adds docked item(s) to the panel. Parameters:
component.

: Object/Array

The Component or array of components to add. The components must include a 'dock' paramater on each component to indicate where it should be docked ('top', 'right', 'bottom', 'left'). Panel
pos

: Number

(optional) The index at which the Component will be added Returns:

void

addEvents( Object|String o, string Optional. ) : void Adds 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:
o

: Object|String

Either an object with event names as properties with a value of true or the first event name string if multiple event names are being passed as separate parameters. Observa ble Optional. : string Event name if multiple event names are being passed as separate parameters. Usage:
this.addEvents('storeloaded', 'storecleared');

Returns:

void

addListener( String eventName, Function handler, [Object scope], [Object options] ) : void Appends an event handler to this object. Appends an event handler to this object. Observa Parameters: ble
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 (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. properties. This may contain any of the following properties:
o

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.

target : 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 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 });

. Returns:

void

addManagedListener( Observable|Element item, Object|String ename, Function fn, Object scope, Object opt ) : void Adds listeners to any Observable object (or Element) which are automatically removed when Observa ble this Component is destroyed... Adds listeners to any Observable object (or Element) which are automatically removed when

this Component is destroyed. 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 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.
opt

: Object

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

void

child( String selector ) : Ext.Component Retrieves the first direct child of this container which matches the passed selector. The passed in selector must com... Retrieves the first direct child of this container which matches the passed selector. The passed in selector must comply with an Ext.ComponentQuery selector. Parameters:
selector

: String

Contain er

An Ext.ComponentQuery selector Returns:


Ext.Component

clearListeners() : void Removes all listeners for this object including the managed listeners Removes all listeners for this object including the managed listeners Parameters:

Observa ble

None.

Returns:

void

clearManagedListeners() : void Removes all managed listeners for this object. Removes all managed listeners for this object. Parameters:

None.

Observa ble

Returns:

void

destroy() : void Destroys the Component. Destroys the Component. Parameters:

None.

Compon ent

Returns:

void

disable() : Ext.form.FormPanel A convenient method to disable all fields in this forms A convenient method to disable all fields in this forms Parameters:

None.

FormPa nel

Returns:
Ext.form.FormPanel

this This form doComponentLayout() : Ext.Container This method needs to be called whenever you change something on this component that requires the components layout to... Compon This method needs to be called whenever you change something on this component that ent 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:

None.

Returns:
Ext.Container

this doLayout() : Ext.Container Force this container's layout to be recalculated. A call to this function is required after adding a new component to... Force this container's layout to be recalculated. A call to this function is required after adding a new component to an already rendered container, or possibly after changing sizing/position properties of child components. Parameters:

None.

Contain er

Returns:
Ext.Container

this down( String selector ) : Ext.Component Retrieves the first descendant of this container which matches the passed selector. The passed in selector must compl... Retrieves the first descendant of this container which matches the passed selector. The passed in selector must comply with an Ext.ComponentQuery selector. Parameters:
selector

: String

Contain er

An Ext.ComponentQuery selector Returns:


Ext.Component

enable() : Ext.form.FormPanel A convenient method to enable all fields in this forms A convenient method to enable all fields in this forms Parameters:

FormPa nel

None.

Returns:

Ext.form.FormPanel

this This form enableBubble( String/Array events ) : void Enables 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.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'); } } });

Observa ble

Parameters:
events

: String/Array

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

void

fireEvent( String eventName, Object... args ) : Boolean Fires 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:
eventName

: String

Observa ble

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. getActiveItem() : activeItem Returns the current activeItem for the layout (only for a card layout) Returns the current activeItem for the layout (only for a card layout) Parameters:

None.

Contain er

Returns:
activeItem

activeItem Current active component 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:

Compon ent

None.

Returns:
Ext.Container

the Container which owns this Component. getComponent( String/Number comp ) : Ext.Component Attempts a default component lookup (see Ext.Container.getComponent). If the component is not found in the normal ite... Attempts a default component lookup (see Ext.Container.getComponent). If the component is not found in the normal items, the dockedItems are searched and the matched component (if any) returned (see {@loink #getDockedComponent}). Parameters:
comp

: String/Number

Panel

The docked component id or itemId to find Returns:


Ext.Component

The docked component, if found getDockedComponent( String/Number comp ) : Ext.Component Finds a docked component by id, itemId or position Finds a docked component by id, itemId or position Parameters:
comp

: String/Number Panel

The id, itemId or position of the child component (see getComponent for details) Returns:
Ext.Component

The component (if found) getDockedItems() : Array Retrieve an array of all currently docked components. Retrieve an array of all currently docked components. Parameters:

Panel

None.

Returns:

Array

An array of components. getEl() : void Retrieves the top level element representing this component. Retrieves the top level element representing this component. Parameters:

None.

Compon ent

Returns:

void

getHeight() : Number Gets the current height of the component's underlying element. Gets the current height of the component's underlying element. Parameters:

None.

Compon ent

Returns:
Number

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:

None.

Compon ent

Returns:

void

getInsertPosition( String/Number/Element/HTMLElement position ) : HTMLElement This 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:
position

Compon ent

: 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 getLayout() : Ext.layout.ContainerLayout Returns the layout instance currently associated with this Container. If a layout has not been instantiated yet, that... Returns the layout instance currently associated with this Container. If a layout has not been instantiated yet, that is done first Parameters:

None.

Contain er

Returns:
Ext.layout.ContainerLayout

The layout getRecord() : Ext.data.Model Returns the Model instance currently loaded into this form (if any) Returns the Model instance currently loaded into this form (if any) Parameters:

None.

FormPa nel

Returns:
Ext.data.Model

The Model instance getSize() : Object Gets the current size of the component's underlying element. Gets the current size of the component's underlying element. Parameters:

None.

Returns:
Object

Compon ent

An object containing the element's size {width: (element width), height: (element height)} getValues( Boolean enabled ) : Object Returns an object containing the value of each field in the form, keyed to the field's name. For groups of checkbox ... Returns an object containing the value of each field in the form, keyed to the field's name.

FormPa nel

For groups of checkbox fields with the same name, it will be arrays of values. For examples:
{ name: "Jacky Nguyen", // From a TextField favorites: [ 'pizza', 'noodle', 'cake' ] }

Parameters:
enabled true

: Boolean

to return only enabled fields

Returns:
Object

Object mapping field name to its value getWidth() : Number Gets the current width of the component's underlying element. Gets the current width of the component's underlying element. Parameters:

None.

Compon ent

Returns:
Number

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. Compon ent Example usage:
var t = new Ext.form.Text(); alert(t.getXTypes()); // alerts 'component/field/textfield'

Parameters:

None.

Returns:

String

The xtype hierarchy string hasListener( String eventName ) : Boolean Checks 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:
eventName

: String Observa ble

The name of the event to check for Returns:


Boolean

True if the event is being listened for, else false hide( [Object/String/Boolean animation] ) : void Hide the component Hide the component Parameters:
animation

: Object/String/Boolean

(optional) Defaults to false. Returns:

Compon ent

void

hideMask() : Ext.form.FormPanel Hides a previously shown wait mask (See showMask) Hides a previously shown wait mask (See showMask) Parameters:

None.

FormPa nel

Returns:
Ext.form.FormPanel

this insert( Number index, Ext.Component component ) : Ext.Component Inserts a Component into this Container at a specified index. Fires the beforeadd event before Contain inserting, then fires ... er Inserts a Component into this Container at a specified index. Fires the beforeadd event before inserting, then fires the add event after the Component has been inserted.

Parameters:
index

: Number

The index at which the Component will be inserted into the Container's items collection
component

: Ext.Component

The child Component to insert. Ext uses lazy rendering, and will only render the inserted Component should it become necessary. A Component config object may be passed in order to avoid the overhead of constructing a real Component object if lazy rendering might mean that the inserted Component will not be rendered immediately. To take advantage of this 'lazy instantiation', set the Ext.Component.xtype config property to the registered type of the Component wanted. For a list of all available xtypes, see Ext.Component. Returns:
Ext.Component

component The Component (or config object) that was inserted with the Container's default config values applied. insertDocked( Number pos, Object/Array component. ) : void Inserts docked item(s) to the panel at the indicated position. Inserts docked item(s) to the panel at the indicated position. Parameters:
pos

: Number

The index at which the Component will be inserted


component.

: Object/Array

Panel

The Component or array of components to add. The components must include a 'dock' paramater on each component to indicate where it should be docked ('top', 'right', 'bottom', 'left'). Returns:

void Compon

isDisabled() : Boolean

Method to determine whether this Component is currently disabled. Method to determine whether this Component is currently disabled. Parameters:

ent

None.

Returns:
Boolean

the disabled state of this Component. isDraggable() : Boolean Method to determine whether this Component is draggable. Method to determine whether this Component is draggable. Parameters:

None.

Compon ent

Returns:
Boolean

the draggable state of this component. isDroppable() : Boolean Method to determine whether this Component is droppable. Method to determine whether this Component is droppable. Parameters:

None.

Compon ent

Returns:
Boolean

the droppable state of this component. isFloating() : Boolean Method to determine whether this Component is floating. Method to determine whether this Component is floating. Parameters:

None.

Compon ent

Returns:
Boolean

the floating state of this component. isHidden() : Boolean

Compon

Method to determine whether this Component is currently set to hidden. Method to determine whether this Component is currently set to hidden. Parameters:

ent

None.

Returns:
Boolean

the hidden state of this Component. isVisible() : Boolean Returns true if this component is visible. Returns true if this component is visible. Parameters:

None.

Compon ent

Returns:
Boolean

True if this component is visible, false otherwise. isXType( String xtype, [Boolean shallow] ) : Boolean Tests 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:
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

Compon ent

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. load( Ext.data.Model instance ) : Ext.form.FormPanel (Shortcut to loadRecord method) Loads matching fields from a model instance into this form (Shortcut to loadRecord method) Loads matching fields from a model instance into this form Parameters:
instance

: Ext.data.Model FormPa nel

The model instance Returns:


Ext.form.FormPanel

this loadRecord( Ext.data.Model instance ) : Ext.form.FormPanel Loads matching fields from a model instance into this form Loads matching fields from a model instance into this form Parameters:
instance

: Ext.data.Model FormPa nel

The model instance Returns:


Ext.form.FormPanel

this nextSibling( selector Optional. ) : void Returns the next sibling of this Component. Optionally selects the next sibling which matches the passed ComponentQue... Compon ent 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() Parameters:
Optional.

: selector

A ComponentQuery selector to filter the following items. Returns:

void

on( String eventName, Function handler, [Object scope], [Object options] ) : void Appends an event handler to this object (shorthand for addListener.) Appends an event handler to this object (shorthand for addListener.) Parameters:
eventName

: String

The type of event to listen for


handler

: Function

The method the event invokes


scope

: Object

Observa ble

(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. Returns:

void

previousSibling( selector Optional. ) : void Returns the previous sibling of this Component. Optionally selects the previous sibling which matches the passed Comp... Returns the previous sibling of this Component. Optionally selects the previous sibling which matches the passed ComponentQuery selector. Compon ent

May also be refered to as prev() Parameters:


Optional.

: selector

A ComponentQuery selector to filter the preceding items. Returns:

void

query( String selector ) : Array Retrieves all descendant components which match the passed selector. Executes an Ext.ComponentQuery.query using this ... Retrieves all descendant components which match the passed selector. Executes an Ext.ComponentQuery.query using this container as its root. Parameters:
selector

: String

Contain er

Selector complying to an Ext.ComponentQuery selector Returns:


Array

Ext.Component's which matched the selector relayEvents( Object o, Array events ) : void Relays 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:
o

: Object Observa ble

The Observable whose events this object is to relay.


events

: Array

Array of event names to relay. Returns:

void Contain er

remove( Component/String component, [Boolean autoDestroy] ) : Ext.Component Removes a component from this container. Fires the beforeremove event before removing, then fires the remove event a...

Removes a component from this container. Fires the beforeremove event before removing, then fires the remove event after the component has been removed. Parameters:
component

: Component/String

The component reference or id to remove.


autoDestroy

: Boolean

(optional) True to automatically invoke the removed Component's Ext.Component.destroy function. Defaults to the value of this Container's autoDestroy config. Returns:
Ext.Component

component The Component that was removed. removeAll( [Boolean autoDestroy] ) : Array Removes all components from this container. Removes all components from this container. Parameters:
autoDestroy

: Boolean

Contain (optional) True to automatically invoke the removed Component's Ext.Component.destroy function. Defaults to the value of this Container's autoDestroy er config. Returns:
Array

Array of the destroyed components 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:

None.

Compon ent

Returns:

void Panel

removeDocked( Ext.Component item., [Boolean autoDestroy] ) : void Removes the docked item from the panel.

Removes the docked item from the panel. Parameters:


item.

: Ext.Component

The Component to remove.


autoDestroy

: Boolean

(optional) Destroy the component after removal. Returns:

void

removeListener( String eventName, Function handler, [Object scope] ) : void Removes an event handler. Removes an event handler. Parameters:
eventName

: String

The type of event the handler was associated with.


handler

: Function Observa ble

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. Returns:

void

removeManagedListener( Observable|Element item, Object|String ename, Function fn, Object scope ) : void Removes listeners that were added by the mon method. Removes listeners that were added by the mon method. Observa Parameters: ble 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 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:

void

reset() : Ext.form.FormPanel Resets all fields in the form back to their original values Resets all fields in the form back to their original values Parameters:

None.

FormPa nel

Returns:
Ext.form.FormPanel

this This form 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. Observa Parameters: ble None. Returns:

void

setActiveItem( Ext.Component/Number/Object card, [String/Object cardSwitchAnim ation] ) : Ext.Container Contain Allows you to set the active card in this container. This method is only available if the er container uses a CardLayout... Allows you to set the active card in this container. This method is only available if the

container uses a CardLayout. Note that a Carousel and TabPanel both get a CardLayout automatically, so both of those components are able to use this method. Parameters:
card

: Ext.Component/Number/Object

The card you want to be made active. A number is interpreted as a card index. An object will be converted to a Component using the objects xtype property, then added to the container and made active. Passing a Component will make sure the component is a child of this container, and then make it active.
cardSwitchAnimation

: String/Object

(optional) The cardSwitchAnimation used to switch between the cards. This can be an animation type string or an animation configuration object. Returns:
Ext.Container

this setCentered( Boolean centered ) : void Show 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:
centered

: Boolean

Compon ent

True to center, false to remove centering Returns:

void

setDisabled( Boolean disabled ) : void Enable or disable the component. Enable or disable the component. Parameters:
disabled

: Boolean

Compon ent

Returns:

void Compon

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:

ent

None.

Returns:
Component

this setDraggable( Boolean/Mixed draggable, Boolean autoShow ) : void Sets a Component as draggable. Sets a Component as draggable. Parameters:
draggable

: Boolean/Mixed Compon ent

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

Returns:

void

setFloating( Boolean floating, Boolean autoShow ) : void Sets a Component as floating. Sets a Component as floating. Parameters:
floating autoShow

: Boolean : Boolean

Compon ent

Returns:

void

setHeight( Number height ) : Ext.Component Sets the height of the component. This method fires the resize event. Sets the height of the component. This method fires the resize event. Parameters:

Compon ent

height

: Number

The new height to set. This may be one of:


o o o

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 setLoading( Boolean/Object load, Boolean targetEl ) : Ext.LoadMask This 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:
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

Compon ent

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. setOrientation( String orientation, Number/String width, Number/String height ) : void Sets the orientation for the Panel. Sets the orientation for the Panel. Parameters:
orientation

: String

Compon ent

'landscape' or 'portrait'
width

: Number/String

New width of the Panel.


height

: Number/String

New height of the Panel. Returns:

void

setPosition( Number left, Number top ) : Ext.Component Sets 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:
left

: Number Compon ent

The new left


top

: Number

The new top Returns:


Ext.Component

this setScrollable( Mixed config ) : void Sets a Component as scrollable. Sets a Component as scrollable. Parameters:
config

: Mixed Compon ent

Acceptable values are a Ext.Scroller configuration, 'horizontal', 'vertical', 'both', and false Returns:

void

setSize( Mixed width, Mixed height ) : Ext.Component Sets the width and height of this Component. This method fires the resize event. This method Compon ent 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:
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). o A String used to set the CSS width style. o A size object in the format {width: widthValue, height: heightValue}. o undefined to 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:
o o o o

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. undefined to leave the height unchanged.

Returns:
Ext.Component

this setValues( Object values ) : Ext.form.FormPanel Sets the values of form fields in bulk. Example usage: myForm.setValues({ name: 'Ed', crazy: true, userna... Sets the values of form fields in bulk. Example usage:
myForm.setValues({ name: 'Ed', crazy: true, username: 'edspencer' });

If there groups of checkbox fields with the same name, pass their values in an array. For example:
myForm.setValues({ name: 'Jacky', crazy: false, hobbies: [ 'reading', 'cooking', 'gaming' ] });

FormPa nel

Parameters:

values

: Object

field name => value mapping object Returns:


Ext.form.FormPanel

this setVisible( Boolean visible ) : Ext.Component Convenience function to hide or show this component by boolean. Convenience function to hide or show this component by boolean. Parameters:
visible

: Boolean Compon ent

True to show, false to hide Returns:


Ext.Component

this setWidth( Number width ) : Ext.Component Sets the width of the component. This method fires the resize event. Sets the width of the component. This method fires the resize event. Parameters:
width

: Number

The new width to setThis may be one of:


o o

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.

Compon ent

Returns:
Ext.Component

this show( [Object/String/Boolean animation] ) : void Show the component. Show the component. Parameters:

Compon ent

animation

: Object/String/Boolean

(optional) Defaults to false. Returns:

void

showBy( Mixed alignTo, Object/String/Boolean animation, Boolean allowOnSide ) : void Show this component relative another component or element. Show this component relative another component or element. Parameters:
alignTo

: Mixed Compon ent

Element or Component
animation : Object/String/Boolean allowOnSide : Boolean

true to allow this element to be aligned on the left or right. Returns:

void

showMask( String/Object cfg, String/Element target ) : Ext.form.FormPanel Shows a generic/custom mask over a designated Element. Shows a generic/custom mask over a designated Element. Parameters:
cfg

: String/Object

Either a string message or a configuration object supporting the following options:


{ message transparent target cls customImageUrl } : : : : : 'Please Wait', false, Ext.getBody(), 'form-mask', 'trident.jpg' //optional target Element

FormPa nel

This object is passed to the waitTpl for use with a custom masking implementation.
target

: String/Element

The target Element instance or Element id to use as the masking agent for the operation (defaults the container Element of the component) Returns:
Ext.form.FormPanel

this submit( Object options ) : Ext.data.Connection Performs a Ajax-based submission of form values (if standardSubmit is false) or otherwise executes a standard HTML F... Performs a Ajax-based submission of form values (if standardSubmit is false) or otherwise executes a standard HTML Form submit action. Parameters:
options

: Object

Unless otherwise noted, options may include the following:


o

url : String The url for the action (defaults to the form's url.)

method : String The form method to use (defaults to the form's method, or POST if not defined)

params : String/Object The params to pass (defaults to the FormPanel's baseParams, or none if not defined) Parameters are encoded as standard HTTP parameters using Ext.urlEncode.

FormPa nel

headers : Object Request headers to set for the action (defaults to the form's default headers)

autoAbort : Boolean
true

to abort any pending Ajax request prior to submission (defaults to false) Note: Has no effect when standardSubmit is enabled.
o

submitDisabled : Boolean
true

to submit all fields regardless of disabled state (defaults to false) Note: Has no effect when standardSubmit is enabled.

waitMsg : String/Config If specified, the value is applied to the waitTpl if defined, and rendered to the waitMsgTarget prior to a Form submit action.

success : Function The callback that will be invoked after a successful response. A response is successful if a response is received from the server and is a JSON object where the success property is set to true, {"success": true} The function is passed the following parameters: form : Ext.FormPanel The form that requested the action result : The result object returned by the server as a result of the submit request. failure : Function The callback that will be invoked after a failed transaction attempt. The function is passed the following parameters: form : The Ext.FormPanel that requested the submit. result : The failed response or result object returned by the server which performed the operation. scope : Object The scope in which to call the callback functions (The this reference for the callback functions).

Returns:
Ext.data.Connection

request Object suspendEvents( Boolean queueSuspended ) : void Suspend the firing of all events. (see resumeEvents) Suspend the firing of all events. (see resumeEvents) Parameters:
queueSuspended

: Boolean Observa ble

Pass as true to queue up suspended events to be fired after the resumeEvents call instead of discarding all suspended events; Returns:

void Observa

un( String eventName, Function handler, [Object scope] ) : void

Removes an event handler (shorthand for removeListener.) Removes an event handler (shorthand for removeListener.) Parameters:
eventName

ble

: 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. Returns:

void

up( String selector ) : Ext.Container Walks up the ownerCt axis looking for an ancestor Container which matches the passed simple selector. Example:var own... Walks up the ownerCt axis looking for an ancestor Container which matches the passed simple selector. Example:
var owningTabContainer = grid.up('tabcontainer');

Parameters:
selector

Compon ent : String

Optional. The simple selector to test. Returns:


Ext.Container

The matching ancestor Container (or <code>undefined</code> if no match was found). update( Mixed htmlOrData, [Boolean loadScripts], [Function callback] ) : void Update the content area of a component. Update the content area of a component. Parameters:

Compon ent

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

void

updateRecord( Ext.data.Model instance, Boolean enabled ) : Ext.form.FormPanel Updates a model instance with the current values of this form Updates a model instance with the current values of this form Parameters:
instance

: Ext.data.Model

The model instance


enabled true

: Boolean

FormPa nel

to update the Model with values from enabled fields only

Returns:
Ext.form.FormPanel

this

Public Events
Event activate : ( Ext.Component this ) Fires after a Component has been visually activated. Fires after a Component has been visually activated. Defined By Compon ent

Listeners will be called with the following arguments:


this

: Ext.Component

add : ( Ext.Container this, Ext.Component component, Number index ) Listeners will be called with the following arguments:
this : Ext.Container component : Ext.Component

The component that was added


index

Containe r

: Number

The index at which the component was added to the container's items collection 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:
this : Ext.Component container : Ext.Container

Compon ent

Parent Container
pos

: Number

position of Component afterlayout : ( Ext.Container this, ContainerLayout layout ) Fires when the components in this container are arranged by the associated layout manager. Fires when the components in this container are arranged by the associated layout manager. Listeners will be called with the following arguments:
this : Ext.Container layout : ContainerLayout

Containe r

The ContainerLayout implementation for this container 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: Compon ent

this

: Ext.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 Compon can prevent the activate from occurring. ent Listeners will be called with the following arguments:
this

: Ext.Component

beforeadd : ( Ext.Container this, Ext.Component component, Number index ) Fires before any Ext.Component is added or inserted into the container. A handler can return false to cancel the add. Fires before any Ext.Component is added or inserted into the container. A handler can return false to cancel the add. Listeners will be called with the following arguments:
this : Ext.Container component : Ext.Component

Containe r

The component being added


index

: Number

The index at which the component will be added to the container's items collection beforecardswitch : ( Ext.Container this, Ext.Component newCard, Ext.Component oldCard, Number ind ex, Boolean animated ) Fires before this container switches the active card. This event is only available if this container uses a CardLayou... Fires before this container switches the active card. This event is only available if this container uses a CardLayout. Note that TabPanel and Carousel both get a CardLayout by default, so both will have this event. A handler can return false to cancel the card switch. Listeners will be called with the following arguments:
this : Ext.Container newCard : Ext.Component

Containe r

The card that will be switched to


oldCard

: Ext.Component

The card that will be switched from


index

: Number

The index of the card that will be switched to


animated

: Boolean

True if this cardswitch will be animated 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:
this

Compon ent

: Ext.Component

beforedestroy : ( Ext.Component this ) Fires before the component is destroyed. Return false from an event handler to stop the destroy. Fires before the component is destroyed. Return false from an event handler to stop the destroy. Listeners will be called with the following arguments:
this

Compon ent

: Ext.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:
this

Compon ent

: Ext.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:
this : Ext.Panel orientation : String

Compon ent

'landscape' or 'portrait'
width : Number height : Number

beforeremove : ( Ext.Container this, Ext.Component component ) Fires before any Ext.Component is removed from the container. A handler can return false to cancel the remove. Fires before any Ext.Component is removed from the container. A handler can return false to cancel the remove. Containe Listeners will be called with the following arguments: r
this : Ext.Container component : Ext.Component

The component being removed beforerender : ( Ext.Component this ) Fires before the component is rendered. Return false from an event handler to stop the render. Fires before the component is rendered. Return false from an event handler to stop the render. Listeners will be called with the following arguments:
this

Compon ent

: Ext.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:
this

Compon ent

: Ext.Component

beforesubmit : ( Ext.FormPanel this, Object values, Object options ) Fires immediately preceding any Form submit action. Implementations may adjust submitted form values or options prior... Fires immediately preceding any Form submit action. Implementations may adjust submitted form values or options prior to execution. A return value of false from this listener will abort the submission attempt (regardless of standardSubmit configuration) Listeners will be called with the following arguments:
this

: Ext.FormPanel

This FormPanel
values

FormPan el

: Object

A hash collection of the qualified form values about to be submitted


options

: Object

Submission options hash (only available when standardSubmit is false)

bodyresize : ( Ext.Panel p, Number width, Number height ) Fires after the Panel has been resized. Fires after the Panel has been resized. Listeners will be called with the following arguments:
p

: Ext.Panel Panel

the Panel which has been resized.


width

: Number

The Panel body's new width.


height

: Number

The Panel body's new height. cardswitch : ( Ext.Container this, Ext.Component newCard, Ext.Component oldCard, Number ind ex, Boolean animated ) Fires after this container switches the active card. If the card is switched using an animation, this event will fire... Fires after this container switches the active card. If the card is switched using an animation, this event will fire after the animation has finished. This event is only available if this container uses a CardLayout. Note that TabPanel and Carousel both get a CardLayout by default, so both will have this event. Listeners will be called with the following arguments:
this : Ext.Container newCard : Ext.Component

The card that has been switched to


oldCard

Containe r

: Ext.Component

The card that has been switched from


index

: Number

The index of the card that has been switched to


animated

: Boolean

True if this cardswitch was animated 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:

Compon ent

this

: Ext.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:
this

Compon ent

: Ext.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:
this

Compon ent

: Ext.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:
this

Compon ent

: Ext.Component

exception : ( Ext.FormPanel this, Object result ) Fires when either the Ajax HTTP request reports a failure OR the server returns a success:false response in the resul... Fires when either the Ajax HTTP request reports a failure OR the server returns a success:false response in the result payload. Listeners will be called with the following arguments:
this

: Ext.FormPanel

FormPan el

This FormPanel
result

: Object

Either a failed Ext.data.Connection request object or a failed (logical) server response payload. hide : ( Ext.Component this ) Fires after the component is hidden. Fires after the component is hidden when calling the Compon hide method. ent 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:

this

: Ext.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:
this : Ext.Component x : Number

Compon ent

The new x position


y

: Number

The new y position 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:
this : Ext.Panel orientation : String

Compon ent

'landscape' or 'portrait'
width : Number height : Number

remove : ( Ext.Container this, Ext.Component component ) Listeners will be called with the following arguments:
this : Ext.Container component : Ext.Component

Containe r

The component that was removed 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:
this : Ext.Component ownerCt : Ext.Container

Compon ent

Container which holds the component render : ( Ext.Component this )

Compon

Fires after the component markup is rendered. Fires after the component markup is rendered. Listeners will be called with the following arguments:
this

ent

: Ext.Component

resize : ( Ext.Component this, Number adjWidth, Number adjHeight, Number rawWidth, Numbe r rawHeight ) Fires after the component is resized. Fires after the component is resized. Listeners will be called with the following arguments:
this : Ext.Component adjWidth : Number

The box-adjusted width that was set


adjHeight

: Number

Compon ent

The box-adjusted height that was set


rawWidth

: Number

The width that was originally specified


rawHeight

: Number

The height that was originally specified 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:
this

Compon ent

: Ext.Component

submit : ( Ext.FormPanel this, Object result ) Fires upon successful (Ajax-based) form submission Fires upon successful (Ajax-based) form submission Listeners will be called with the following arguments:
this

: Ext.FormPanel

FormPan el

This FormPanel
result

: Object

The result object as returned by the server

You might also like