You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

310 lines
11 KiB

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