13693261870
2022-09-16 354b3dbfbffb3df45212a2a44dbbf48b4acc2594
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
<!DOCTYPE html>
<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>
  <style type="text/css">
    .highlight { display: block; background-color: #ddd; }
  </style>
  <script type="text/javascript">
    function highlight() {
      document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
    }
  </script>
</head>
<body onload="prettyPrint(); highlight();">
  <pre class="prettyprint lang-js"><span id='Ext-form-field-Display'>/**
</span> * A display-only text field which is not validated and not submitted. This is useful for when you want to display a
 * value from a form's {@link Ext.form.Basic#load loaded data} but do not want to allow the user to edit or submit that
 * value. The value can be optionally {@link #htmlEncode HTML encoded} if it contains HTML markup that you do not want
 * to be rendered.
 *
 * If you have more complex content, or need to include components within the displayed content, also consider using a
 * {@link Ext.form.FieldContainer} instead.
 *
 * Example:
 *
 *     @example
 *     Ext.create('Ext.form.Panel', {
 *         renderTo: Ext.getBody(),
 *         width: 175,
 *         height: 120,
 *         bodyPadding: 10,
 *         title: 'Final Score',
 *         items: [{
 *             xtype: 'displayfield',
 *             fieldLabel: 'Home',
 *             name: 'home_score',
 *             value: '10'
 *         }, {
 *             xtype: 'displayfield',
 *             fieldLabel: 'Visitor',
 *             name: 'visitor_score',
 *             value: '11'
 *         }],
 *         buttons: [{
 *             text: 'Update'
 *         }]
 *     });
 */
Ext.define('Ext.form.field.Display', {
    extend:'Ext.form.field.Base',
    alias: 'widget.displayfield',
    requires: ['Ext.util.Format', 'Ext.XTemplate'],
    alternateClassName: ['Ext.form.DisplayField', 'Ext.form.Display'],
<span id='Ext-form-field-Display-cfg-fieldSubTpl'>    fieldSubTpl: [
</span>        '&lt;div id=&quot;{id}&quot; role=&quot;input&quot; ',
        '&lt;tpl if=&quot;fieldStyle&quot;&gt; style=&quot;{fieldStyle}&quot;&lt;/tpl&gt;', 
        ' class=&quot;{fieldCls}&quot;&gt;{value}&lt;/div&gt;',
        {
            compiled: true,
            disableFormats: true
        }
    ],
 
<span id='Ext-form-field-Display-cfg-readOnly'>    /**
</span>     * @cfg {Boolean} readOnly
     * @private
     */
    readOnly: true,
 
<span id='Ext-form-field-Display-cfg-fieldCls'>    /**
</span>     * @cfg {String} [fieldCls=&quot;x-form-display-field&quot;]
     * The default CSS class for the field.
     */
    fieldCls: Ext.baseCSSPrefix + 'form-display-field',
 
<span id='Ext-form-field-Display-cfg-fieldBodyCls'>    fieldBodyCls: Ext.baseCSSPrefix + 'form-display-field-body',
</span>
<span id='Ext-form-field-Display-cfg-htmlEncode'>    /**
</span>     * @cfg {Boolean} htmlEncode
     * True to escape HTML in text when rendering it.
     */
    htmlEncode: false,
    
<span id='Ext-form-field-Display-cfg-renderer'>    /**
</span>     * @cfg {Function} renderer
     * A function to transform the raw value for display in the field. The function will receive 2 arguments, the raw value
     * and the {@link Ext.form.field.Display} object.
     */
    
<span id='Ext-form-field-Display-cfg-scope'>    /**
</span>     * @cfg {Object} scope
     * The scope to execute the {@link #renderer} function. Defaults to this.
     */
 
    noWrap: false,
    
<span id='Ext-form-field-Display-cfg-validateOnChange'>    /**
</span>     * @cfg {Boolean} validateOnChange
     * @private
     */
    validateOnChange: false,
 
<span id='Ext-form-field-Display-method-initEvents'>    initEvents: Ext.emptyFn,
</span>
<span id='Ext-form-field-Display-cfg-submitValue'>    submitValue: false,
</span>    
<span id='Ext-form-field-Display-method-isDirty'>    isDirty: function(){
</span>        return false;
    },
 
<span id='Ext-form-field-Display-method-isValid'>    isValid: function() {
</span>        return true;
    },
 
<span id='Ext-form-field-Display-method-validate'>    validate: function() {
</span>        return true;
    },
 
<span id='Ext-form-field-Display-method-getRawValue'>    getRawValue: function() {
</span>        return this.rawValue;
    },
 
<span id='Ext-form-field-Display-method-setRawValue'>    setRawValue: function(value) {
</span>        var me = this;
            
        value = Ext.value(value, '');
        me.rawValue = value;
        if (me.rendered) {
            me.inputEl.dom.innerHTML = me.getDisplayValue();
            me.updateLayout();
        }
        return value;
    },
 
<span id='Ext-form-field-Display-method-getDisplayValue'>    /**
</span>     * @private
     * Format the value to display.
     */
    getDisplayValue: function() {
        var me = this,
            value = this.getRawValue(),
            display;
        if (me.renderer) {
             display = me.renderer.call(me.scope || me, value, me);
        } else {
             display = me.htmlEncode ? Ext.util.Format.htmlEncode(value) : value;
        }
        return display;
    },
        
<span id='Ext-form-field-Display-method-getSubTplData'>    getSubTplData: function() {
</span>        var ret = this.callParent(arguments);
 
        ret.value = this.getDisplayValue();
 
        return ret;
    }
 
<span id='Ext-form-field-Display-cfg-inputType'>    /**
</span>     * @cfg {String} inputType
     * @private
     */
<span id='Ext-form-field-Display-cfg-disabled'>    /**
</span>     * @cfg {Boolean} disabled
     * @private
     */
<span id='Ext-form-field-Display-cfg-checkChangeEvents'>    /**
</span>     * @cfg {Number} checkChangeEvents
     * @private
     */
<span id='Ext-form-field-Display-cfg-checkChangeBuffer'>    /**
</span>     * @cfg {Number} checkChangeBuffer
     * @private
     */
});
</pre>
</body>
</html>