Upgrade to ExtJS 4.0.7 - Released 10/19/2011
[extjs.git] / docs / source / Trigger2.html
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-layout-component-field-Trigger'>/**
19 </span> * @private
20  * @class Ext.layout.component.field.Trigger
21  * @extends Ext.layout.component.field.Field
22  * Layout class for {@link Ext.form.field.Trigger} fields. Adjusts the input field size to accommodate
23  * the trigger button(s).
24  * @private
25  */
26
27 Ext.define('Ext.layout.component.field.Trigger', {
28
29     /* Begin Definitions */
30
31     alias: ['layout.triggerfield'],
32
33     extend: 'Ext.layout.component.field.Field',
34
35     /* End Definitions */
36
37     type: 'triggerfield',
38
39     sizeBodyContents: function(width, height) {
40         var me = this,
41             owner = me.owner,
42             inputEl = owner.inputEl,
43             triggerWrap = owner.triggerWrap,
44             triggerWidth = owner.getTriggerWidth();
45
46         // If we or our ancestor is hidden, we can get a triggerWidth calculation
47         // of 0.  We don't want to resize in this case.
48         if (owner.hideTrigger || owner.readOnly || triggerWidth &gt; 0) {
49             // Decrease the field's width by the width of the triggers. Both the field and the triggerWrap
50             // are floated left in CSS so they'll stack up side by side.
51             me.setElementSize(inputEl, Ext.isNumber(width) ? width - triggerWidth : width);
52     
53             // Explicitly set the triggerWrap's width, to prevent wrapping
54             triggerWrap.setWidth(triggerWidth);
55         }
56     }
57 });</pre>
58 </body>
59 </html>