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