1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307
|
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>The source code</title>
<link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="../resources/prettify/prettify.js"></script>
</head>
<body onload="prettyPrint();">
<pre class="prettyprint lang-js">/*!
* Ext JS Library 3.4.0
* Copyright(c) 2006-2011 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
<div id="cls-Ext.form.FieldSet"></div>/**
* @class Ext.form.FieldSet
* @extends Ext.Panel
* Standard container used for grouping items within a {@link Ext.form.FormPanel form}.
* <pre><code>
var form = new Ext.FormPanel({
title: 'Simple Form with FieldSets',
labelWidth: 75, // label settings here cascade unless overridden
url: 'save-form.php',
frame:true,
bodyStyle:'padding:5px 5px 0',
width: 700,
renderTo: document.body,
layout:'column', // arrange items in columns
defaults: { // defaults applied to items
layout: 'form',
border: false,
bodyStyle: 'padding:4px'
},
items: [{
// Fieldset in Column 1
xtype:'fieldset',
columnWidth: 0.5,
title: 'Fieldset 1',
collapsible: true,
autoHeight:true,
defaults: {
anchor: '-20' // leave room for error icon
},
defaultType: 'textfield',
items :[{
fieldLabel: 'Field 1'
}, {
fieldLabel: 'Field 2'
}, {
fieldLabel: 'Field 3'
}
]
},{
// Fieldset in Column 2 - Panel inside
xtype:'fieldset',
title: 'Show Panel', // title, header, or checkboxToggle creates fieldset header
autoHeight:true,
columnWidth: 0.5,
checkboxToggle: true,
collapsed: true, // fieldset initially collapsed
layout:'anchor',
items :[{
xtype: 'panel',
anchor: '100%',
title: 'Panel inside a fieldset',
frame: true,
height: 100
}]
}]
});
* </code></pre>
* @constructor
* @param {Object} config Configuration options
* @xtype fieldset
*/
Ext.form.FieldSet = Ext.extend(Ext.Panel, {
<div id="cfg-Ext.form.FieldSet-checkboxToggle"></div>/**
* @cfg {Mixed} checkboxToggle <tt>true</tt> to render a checkbox into the fieldset frame just
* in front of the legend to expand/collapse the fieldset when the checkbox is toggled. (defaults
* to <tt>false</tt>).
* <p>A {@link Ext.DomHelper DomHelper} element spec may also be specified to create the checkbox.
* If <tt>true</tt> is specified, the default DomHelper config object used to create the element
* is:</p><pre><code>
* {tag: 'input', type: 'checkbox', name: this.checkboxName || this.id+'-checkbox'}
* </code></pre>
*/
<div id="cfg-Ext.form.FieldSet-checkboxName"></div>/**
* @cfg {String} checkboxName The name to assign to the fieldset's checkbox if <tt>{@link #checkboxToggle} = true</tt>
* (defaults to <tt>'[checkbox id]-checkbox'</tt>).
*/
<div id="cfg-Ext.form.FieldSet-collapsible"></div>/**
* @cfg {Boolean} collapsible
* <tt>true</tt> to make the fieldset collapsible and have the expand/collapse toggle button automatically
* rendered into the legend element, <tt>false</tt> to keep the fieldset statically sized with no collapse
* button (defaults to <tt>false</tt>). Another option is to configure <tt>{@link #checkboxToggle}</tt>.
*/
<div id="cfg-Ext.form.FieldSet-labelWidth"></div>/**
* @cfg {Number} labelWidth The width of labels. This property cascades to child containers.
*/
<div id="cfg-Ext.form.FieldSet-itemCls"></div>/**
* @cfg {String} itemCls A css class to apply to the <tt>x-form-item</tt> of fields (see
* {@link Ext.layout.FormLayout}.{@link Ext.layout.FormLayout#fieldTpl fieldTpl} for details).
* This property cascades to child containers.
*/
<div id="cfg-Ext.form.FieldSet-baseCls"></div>/**
* @cfg {String} baseCls The base CSS class applied to the fieldset (defaults to <tt>'x-fieldset'</tt>).
*/
baseCls : 'x-fieldset',
<div id="cfg-Ext.form.FieldSet-layout"></div>/**
* @cfg {String} layout The {@link Ext.Container#layout} to use inside the fieldset (defaults to <tt>'form'</tt>).
*/
layout : 'form',
<div id="cfg-Ext.form.FieldSet-animCollapse"></div>/**
* @cfg {Boolean} animCollapse
* <tt>true</tt> to animate the transition when the panel is collapsed, <tt>false</tt> to skip the
* animation (defaults to <tt>false</tt>).
*/
animCollapse : false,
// private
onRender : function(ct, position){
if(!this.el){
this.el = document.createElement('fieldset');
this.el.id = this.id;
if (this.title || this.header || this.checkboxToggle) {
this.el.appendChild(document.createElement('legend')).className = this.baseCls + '-header';
}
}
Ext.form.FieldSet.superclass.onRender.call(this, ct, position);
if(this.checkboxToggle){
var o = typeof this.checkboxToggle == 'object' ?
this.checkboxToggle :
{tag: 'input', type: 'checkbox', name: this.checkboxName || this.id+'-checkbox'};
this.checkbox = this.header.insertFirst(o);
this.checkbox.dom.checked = !this.collapsed;
this.mon(this.checkbox, 'click', this.onCheckClick, this);
}
},
// private
onCollapse : function(doAnim, animArg){
if(this.checkbox){
this.checkbox.dom.checked = false;
}
Ext.form.FieldSet.superclass.onCollapse.call(this, doAnim, animArg);
},
// private
onExpand : function(doAnim, animArg){
if(this.checkbox){
this.checkbox.dom.checked = true;
}
Ext.form.FieldSet.superclass.onExpand.call(this, doAnim, animArg);
},
<div id="method-Ext.form.FieldSet-onCheckClick"></div>/**
* This function is called by the fieldset's checkbox when it is toggled (only applies when
* checkboxToggle = true). This method should never be called externally, but can be
* overridden to provide custom behavior when the checkbox is toggled if needed.
*/
onCheckClick : function(){
this[this.checkbox.dom.checked ? 'expand' : 'collapse']();
}
<div id="cfg-Ext.form.FieldSet-activeItem"></div>/**
* @cfg {String/Number} activeItem
* @hide
*/
<div id="cfg-Ext.form.FieldSet-applyTo"></div>/**
* @cfg {Mixed} applyTo
* @hide
*/
<div id="cfg-Ext.form.FieldSet-bodyBorder"></div>/**
* @cfg {Boolean} bodyBorder
* @hide
*/
<div id="cfg-Ext.form.FieldSet-border"></div>/**
* @cfg {Boolean} border
* @hide
*/
<div id="cfg-Ext.form.FieldSet-bufferResize"></div>/**
* @cfg {Boolean/Number} bufferResize
* @hide
*/
<div id="cfg-Ext.form.FieldSet-collapseFirst"></div>/**
* @cfg {Boolean} collapseFirst
* @hide
*/
<div id="cfg-Ext.form.FieldSet-defaultType"></div>/**
* @cfg {String} defaultType
* @hide
*/
<div id="cfg-Ext.form.FieldSet-disabledClass"></div>/**
* @cfg {String} disabledClass
* @hide
*/
<div id="cfg-Ext.form.FieldSet-elements"></div>/**
* @cfg {String} elements
* @hide
*/
<div id="cfg-Ext.form.FieldSet-floating"></div>/**
* @cfg {Boolean} floating
* @hide
*/
<div id="cfg-Ext.form.FieldSet-footer"></div>/**
* @cfg {Boolean} footer
* @hide
*/
<div id="cfg-Ext.form.FieldSet-frame"></div>/**
* @cfg {Boolean} frame
* @hide
*/
<div id="cfg-Ext.form.FieldSet-header"></div>/**
* @cfg {Boolean} header
* @hide
*/
<div id="cfg-Ext.form.FieldSet-headerAsText"></div>/**
* @cfg {Boolean} headerAsText
* @hide
*/
<div id="cfg-Ext.form.FieldSet-hideCollapseTool"></div>/**
* @cfg {Boolean} hideCollapseTool
* @hide
*/
<div id="cfg-Ext.form.FieldSet-iconCls"></div>/**
* @cfg {String} iconCls
* @hide
*/
<div id="cfg-Ext.form.FieldSet-shadow"></div>/**
* @cfg {Boolean/String} shadow
* @hide
*/
<div id="cfg-Ext.form.FieldSet-shadowOffset"></div>/**
* @cfg {Number} shadowOffset
* @hide
*/
<div id="cfg-Ext.form.FieldSet-shim"></div>/**
* @cfg {Boolean} shim
* @hide
*/
<div id="cfg-Ext.form.FieldSet-tbar"></div>/**
* @cfg {Object/Array} tbar
* @hide
*/
<div id="cfg-Ext.form.FieldSet-tools"></div>/**
* @cfg {Array} tools
* @hide
*/
<div id="cfg-Ext.form.FieldSet-toolTemplate"></div>/**
* @cfg {Ext.Template/Ext.XTemplate} toolTemplate
* @hide
*/
<div id="cfg-Ext.form.FieldSet-xtype"></div>/**
* @cfg {String} xtype
* @hide
*/
<div id="prop-Ext.form.FieldSet-header"></div>/**
* @property header
* @hide
*/
<div id="prop-Ext.form.FieldSet-footer"></div>/**
* @property footer
* @hide
*/
<div id="method-Ext.form.FieldSet-focus"></div>/**
* @method focus
* @hide
*/
<div id="method-Ext.form.FieldSet-getBottomToolbar"></div>/**
* @method getBottomToolbar
* @hide
*/
<div id="method-Ext.form.FieldSet-getTopToolbar"></div>/**
* @method getTopToolbar
* @hide
*/
<div id="method-Ext.form.FieldSet-setIconClass"></div>/**
* @method setIconClass
* @hide
*/
<div id="event-Ext.form.FieldSet-activate"></div>/**
* @event activate
* @hide
*/
<div id="event-Ext.form.FieldSet-beforeclose"></div>/**
* @event beforeclose
* @hide
*/
<div id="event-Ext.form.FieldSet-bodyresize"></div>/**
* @event bodyresize
* @hide
*/
<div id="event-Ext.form.FieldSet-close"></div>/**
* @event close
* @hide
*/
<div id="event-Ext.form.FieldSet-deactivate"></div>/**
* @event deactivate
* @hide
*/
});
Ext.reg('fieldset', Ext.form.FieldSet);</pre>
</body>
</html>
|