3
* Copyright(c) 2006-2009, Ext JS, LLC.
6
* http://extjs.com/license
10
* @class Ext.form.FieldSet
12
* Standard container used for grouping form fields.
14
* @param {Object} config Configuration options
16
Ext.form.FieldSet = Ext.extend(Ext.Panel, {
18
* @cfg {Mixed} checkboxToggle True to render a checkbox into the fieldset frame just in front of the legend,
19
* or a DomHelper config object to create the checkbox. (defaults to false).
20
* The fieldset will be expanded or collapsed when the checkbox is toggled.
23
* @cfg {String} checkboxName The name to assign to the fieldset's checkbox if {@link #checkboxToggle} = true
24
* (defaults to '[checkbox id]-checkbox').
27
* @cfg {Number} labelWidth The width of labels. This property cascades to child containers.
30
* @cfg {String} itemCls A css class to apply to the x-form-item of fields. This property cascades to child containers.
33
* @cfg {String} baseCls The base CSS class applied to the fieldset (defaults to 'x-fieldset').
37
* @cfg {String} layout The {@link Ext.Container#layout} to use inside the fieldset (defaults to 'form').
41
* @cfg {Boolean} animCollapse
42
* True to animate the transition when the panel is collapsed, false to skip the animation (defaults to false).
47
onRender : function(ct, position){
49
this.el = document.createElement('fieldset');
51
if (this.title || this.header || this.checkboxToggle) {
52
this.el.appendChild(document.createElement('legend')).className = 'x-fieldset-header';
56
Ext.form.FieldSet.superclass.onRender.call(this, ct, position);
58
if(this.checkboxToggle){
59
var o = typeof this.checkboxToggle == 'object' ?
61
{tag: 'input', type: 'checkbox', name: this.checkboxName || this.id+'-checkbox'};
62
this.checkbox = this.header.insertFirst(o);
63
this.checkbox.dom.checked = !this.collapsed;
64
this.checkbox.on('click', this.onCheckClick, this);
69
onCollapse : function(doAnim, animArg){
71
this.checkbox.dom.checked = false;
73
Ext.form.FieldSet.superclass.onCollapse.call(this, doAnim, animArg);
78
onExpand : function(doAnim, animArg){
80
this.checkbox.dom.checked = true;
82
Ext.form.FieldSet.superclass.onExpand.call(this, doAnim, animArg);
86
* This function is called by the fieldset's checkbox when it is toggled (only applies when
87
* checkboxToggle = true). This method should never be called externally, but can be
88
* overridden to provide custom behavior when the checkbox is toggled if needed.
90
onCheckClick : function(){
91
this[this.checkbox.dom.checked ? 'expand' : 'collapse']();
95
beforeDestroy : function(){
97
this.checkbox.un('click', this.onCheckClick, this);
99
Ext.form.FieldSet.superclass.beforeDestroy.call(this);
103
* @cfg {String/Number} activeItem
107
* @cfg {Mixed} applyTo
111
* @cfg {Object/Array} bbar
115
* @cfg {Boolean} bodyBorder
119
* @cfg {Boolean} border
123
* @cfg {Boolean/Number} bufferResize
127
* @cfg {String} buttonAlign
131
* @cfg {Array} buttons
135
* @cfg {Boolean} collapseFirst
139
* @cfg {String} defaultType
143
* @cfg {String} disabledClass
147
* @cfg {String} elements
151
* @cfg {Boolean} floating
155
* @cfg {Boolean} footer
159
* @cfg {Boolean} frame
163
* @cfg {Boolean} header
167
* @cfg {Boolean} headerAsText
171
* @cfg {Boolean} hideCollapseTool
175
* @cfg {String} iconCls
179
* @cfg {Boolean/String} shadow
183
* @cfg {Number} shadowOffset
187
* @cfg {Boolean} shim
191
* @cfg {Object/Array} tbar
195
* @cfg {Boolean} titleCollapse
203
* @cfg {String} xtype
219
* @method getBottomToolbar
223
* @method getTopToolbar
227
* @method setIconClass
251
Ext.reg('fieldset', Ext.form.FieldSet);