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; }
11 <script type="text/javascript">
12 function highlight() {
13 document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
17 <body onload="prettyPrint(); highlight();">
18 <pre class="prettyprint lang-js"><span id='Ext-layout-component-field-Trigger'>/**
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).
27 Ext.define('Ext.layout.component.field.Trigger', {
29 /* Begin Definitions */
31 alias: ['layout.triggerfield'],
33 extend: 'Ext.layout.component.field.Field',
39 sizeBodyContents: function(width, height) {
42 inputEl = owner.inputEl,
43 triggerWrap = owner.triggerWrap,
44 triggerWidth = owner.getTriggerWidth();
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 > 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);
53 // Explicitly set the triggerWrap's width, to prevent wrapping
54 triggerWrap.setWidth(triggerWidth);