ContainerLayout AnchorLayout FormLayout
Package: | Ext.layout |
Defined In: | FormLayout.js |
Class: | FormLayout |
Extends: | AnchorLayout |
This is a layout specifically designed for creating forms. This class can be extended or created via the layout:'form' Ext.Container.layout config, and should generally not need to be created directly via the new keyword. However, when used in an application, it will usually be preferrable to use a Ext.form.FormPanel (which automatically uses FormLayout as its layout class) since it also provides built-in functionality for loading, validating and submitting the form.
Note that when creating a layout via config, the layout-specific config properties must be passed in via the Ext.Container.layoutConfig object which will then be applied internally to the layout. The container using the FormLayout can also supply the following form-specific config properties which will be applied by the layout:
Any type of components can be added to a FormLayout, but items that inherit from Ext.form.Field can also supply the following field-specific config properties:
// Required if showing validation messages
Ext.QuickTips.init();
// While you can create a basic Panel with layout:'form', practically
// you should usually use a FormPanel to also get its form functionality
// since it already creates a FormLayout internally.
var form = new Ext.form.FormPanel({
labelWidth: 75,
title: 'Form Layout',
bodyStyle:'padding:15px',
width: 350,
labelPad: 10,
defaultType: 'textfield',
defaults: {
// applied to each contained item
width: 230,
msgTarget: 'side'
},
layoutConfig: {
// layout-specific configs go here
labelSeparator: ''
},
items: [{
fieldLabel: 'First Name',
name: 'first',
allowBlank: false
},{
fieldLabel: 'Last Name',
name: 'last'
},{
fieldLabel: 'Company',
name: 'company'
},{
fieldLabel: 'Email',
name: 'email',
vtype:'email'
}
],
buttons: [{
text: 'Save'
},{
text: 'Cancel'
}]
});
Config Options | Defined By | |
---|---|---|
elementStyle : String
A CSS style specification string to add to each field element in this layout (defaults to '').
|
FormLayout | |
extraCls : String An optional extra CSS class that will be added to the container (defaults to ''). This can be useful for adding custo...
An optional extra CSS class that will be added to the container (defaults to ''). This can be useful for adding customized styles to the container or any of its children using standard CSS rules.
|
ContainerLayout | |
labelSeparator : String The standard separator to display after the text of each form label (defaults to a colon ':'). To turn off separators...
The standard separator to display after the text of each form label (defaults to a colon ':'). To turn off separators for all fields in this layout by default specify empty string '' (if the labelSeparator value is explicitly set at the field level, those will still be displayed).
|
FormLayout | |
labelStyle : String
A CSS style specification string to add to each field label in this layout (defaults to '').
|
FormLayout | |
renderHidden : Boolean
True to hide each contained item on render (defaults to false).
|
ContainerLayout |