3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
4 <title>The source code</title>
5 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
6 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
8 <body onload="prettyPrint();">
9 <pre class="prettyprint lang-js">/*!
10 * Ext JS Library 3.3.1
11 * Copyright(c) 2006-2010 Sencha Inc.
12 * licensing@sencha.com
13 * http://www.sencha.com/license
15 <div id="cls-Ext.form.FieldSet"></div>/**
16 * @class Ext.form.FieldSet
18 * Standard container used for grouping items within a {@link Ext.form.FormPanel form}.
20 var form = new Ext.FormPanel({
21 title: 'Simple Form with FieldSets',
22 labelWidth: 75, // label settings here cascade unless overridden
25 bodyStyle:'padding:5px 5px 0',
27 renderTo: document.body,
28 layout:'column', // arrange items in columns
29 defaults: { // defaults applied to items
32 bodyStyle: 'padding:4px'
35 // Fieldset in Column 1
42 anchor: '-20' // leave room for error icon
44 defaultType: 'textfield',
54 // Fieldset in Column 2 - Panel inside
56 title: 'Show Panel', // title, header, or checkboxToggle creates fieldset header
60 collapsed: true, // fieldset initially collapsed
65 title: 'Panel inside a fieldset',
73 * @param {Object} config Configuration options
76 Ext.form.FieldSet = Ext.extend(Ext.Panel, {
77 <div id="cfg-Ext.form.FieldSet-checkboxToggle"></div>/**
78 * @cfg {Mixed} checkboxToggle <tt>true</tt> to render a checkbox into the fieldset frame just
79 * in front of the legend to expand/collapse the fieldset when the checkbox is toggled. (defaults
81 * <p>A {@link Ext.DomHelper DomHelper} element spec may also be specified to create the checkbox.
82 * If <tt>true</tt> is specified, the default DomHelper config object used to create the element
84 * {tag: 'input', type: 'checkbox', name: this.checkboxName || this.id+'-checkbox'}
87 <div id="cfg-Ext.form.FieldSet-checkboxName"></div>/**
88 * @cfg {String} checkboxName The name to assign to the fieldset's checkbox if <tt>{@link #checkboxToggle} = true</tt>
89 * (defaults to <tt>'[checkbox id]-checkbox'</tt>).
91 <div id="cfg-Ext.form.FieldSet-collapsible"></div>/**
92 * @cfg {Boolean} collapsible
93 * <tt>true</tt> to make the fieldset collapsible and have the expand/collapse toggle button automatically
94 * rendered into the legend element, <tt>false</tt> to keep the fieldset statically sized with no collapse
95 * button (defaults to <tt>false</tt>). Another option is to configure <tt>{@link #checkboxToggle}</tt>.
97 <div id="cfg-Ext.form.FieldSet-labelWidth"></div>/**
98 * @cfg {Number} labelWidth The width of labels. This property cascades to child containers.
100 <div id="cfg-Ext.form.FieldSet-itemCls"></div>/**
101 * @cfg {String} itemCls A css class to apply to the <tt>x-form-item</tt> of fields (see
102 * {@link Ext.layout.FormLayout}.{@link Ext.layout.FormLayout#fieldTpl fieldTpl} for details).
103 * This property cascades to child containers.
105 <div id="cfg-Ext.form.FieldSet-baseCls"></div>/**
106 * @cfg {String} baseCls The base CSS class applied to the fieldset (defaults to <tt>'x-fieldset'</tt>).
108 baseCls : 'x-fieldset',
109 <div id="cfg-Ext.form.FieldSet-layout"></div>/**
110 * @cfg {String} layout The {@link Ext.Container#layout} to use inside the fieldset (defaults to <tt>'form'</tt>).
113 <div id="cfg-Ext.form.FieldSet-animCollapse"></div>/**
114 * @cfg {Boolean} animCollapse
115 * <tt>true</tt> to animate the transition when the panel is collapsed, <tt>false</tt> to skip the
116 * animation (defaults to <tt>false</tt>).
118 animCollapse : false,
121 onRender : function(ct, position){
123 this.el = document.createElement('fieldset');
124 this.el.id = this.id;
125 if (this.title || this.header || this.checkboxToggle) {
126 this.el.appendChild(document.createElement('legend')).className = this.baseCls + '-header';
130 Ext.form.FieldSet.superclass.onRender.call(this, ct, position);
132 if(this.checkboxToggle){
133 var o = typeof this.checkboxToggle == 'object' ?
134 this.checkboxToggle :
135 {tag: 'input', type: 'checkbox', name: this.checkboxName || this.id+'-checkbox'};
136 this.checkbox = this.header.insertFirst(o);
137 this.checkbox.dom.checked = !this.collapsed;
138 this.mon(this.checkbox, 'click', this.onCheckClick, this);
143 onCollapse : function(doAnim, animArg){
145 this.checkbox.dom.checked = false;
147 Ext.form.FieldSet.superclass.onCollapse.call(this, doAnim, animArg);
152 onExpand : function(doAnim, animArg){
154 this.checkbox.dom.checked = true;
156 Ext.form.FieldSet.superclass.onExpand.call(this, doAnim, animArg);
159 <div id="method-Ext.form.FieldSet-onCheckClick"></div>/**
160 * This function is called by the fieldset's checkbox when it is toggled (only applies when
161 * checkboxToggle = true). This method should never be called externally, but can be
162 * overridden to provide custom behavior when the checkbox is toggled if needed.
164 onCheckClick : function(){
165 this[this.checkbox.dom.checked ? 'expand' : 'collapse']();
168 <div id="cfg-Ext.form.FieldSet-activeItem"></div>/**
169 * @cfg {String/Number} activeItem
172 <div id="cfg-Ext.form.FieldSet-applyTo"></div>/**
173 * @cfg {Mixed} applyTo
176 <div id="cfg-Ext.form.FieldSet-bodyBorder"></div>/**
177 * @cfg {Boolean} bodyBorder
180 <div id="cfg-Ext.form.FieldSet-border"></div>/**
181 * @cfg {Boolean} border
184 <div id="cfg-Ext.form.FieldSet-bufferResize"></div>/**
185 * @cfg {Boolean/Number} bufferResize
188 <div id="cfg-Ext.form.FieldSet-collapseFirst"></div>/**
189 * @cfg {Boolean} collapseFirst
192 <div id="cfg-Ext.form.FieldSet-defaultType"></div>/**
193 * @cfg {String} defaultType
196 <div id="cfg-Ext.form.FieldSet-disabledClass"></div>/**
197 * @cfg {String} disabledClass
200 <div id="cfg-Ext.form.FieldSet-elements"></div>/**
201 * @cfg {String} elements
204 <div id="cfg-Ext.form.FieldSet-floating"></div>/**
205 * @cfg {Boolean} floating
208 <div id="cfg-Ext.form.FieldSet-footer"></div>/**
209 * @cfg {Boolean} footer
212 <div id="cfg-Ext.form.FieldSet-frame"></div>/**
213 * @cfg {Boolean} frame
216 <div id="cfg-Ext.form.FieldSet-header"></div>/**
217 * @cfg {Boolean} header
220 <div id="cfg-Ext.form.FieldSet-headerAsText"></div>/**
221 * @cfg {Boolean} headerAsText
224 <div id="cfg-Ext.form.FieldSet-hideCollapseTool"></div>/**
225 * @cfg {Boolean} hideCollapseTool
228 <div id="cfg-Ext.form.FieldSet-iconCls"></div>/**
229 * @cfg {String} iconCls
232 <div id="cfg-Ext.form.FieldSet-shadow"></div>/**
233 * @cfg {Boolean/String} shadow
236 <div id="cfg-Ext.form.FieldSet-shadowOffset"></div>/**
237 * @cfg {Number} shadowOffset
240 <div id="cfg-Ext.form.FieldSet-shim"></div>/**
241 * @cfg {Boolean} shim
244 <div id="cfg-Ext.form.FieldSet-tbar"></div>/**
245 * @cfg {Object/Array} tbar
248 <div id="cfg-Ext.form.FieldSet-tools"></div>/**
252 <div id="cfg-Ext.form.FieldSet-toolTemplate"></div>/**
253 * @cfg {Ext.Template/Ext.XTemplate} toolTemplate
256 <div id="cfg-Ext.form.FieldSet-xtype"></div>/**
257 * @cfg {String} xtype
260 <div id="prop-Ext.form.FieldSet-header"></div>/**
264 <div id="prop-Ext.form.FieldSet-footer"></div>/**
268 <div id="method-Ext.form.FieldSet-focus"></div>/**
272 <div id="method-Ext.form.FieldSet-getBottomToolbar"></div>/**
273 * @method getBottomToolbar
276 <div id="method-Ext.form.FieldSet-getTopToolbar"></div>/**
277 * @method getTopToolbar
280 <div id="method-Ext.form.FieldSet-setIconClass"></div>/**
281 * @method setIconClass
284 <div id="event-Ext.form.FieldSet-activate"></div>/**
288 <div id="event-Ext.form.FieldSet-beforeclose"></div>/**
292 <div id="event-Ext.form.FieldSet-bodyresize"></div>/**
296 <div id="event-Ext.form.FieldSet-close"></div>/**
300 <div id="event-Ext.form.FieldSet-deactivate"></div>/**
305 Ext.reg('fieldset', Ext.form.FieldSet);</pre>