4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <title>The source code</title>
6 <link href="../prettify/prettify.css" type="text/css" rel="stylesheet" />
7 <script type="text/javascript" src="../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-form-field-Display'>/**
19 </span> * @class Ext.form.field.Display
20 * @extends Ext.form.field.Base
21 * <p>A display-only text field which is not validated and not submitted. This is useful for when you want
22 * to display a value from a form's {@link Ext.form.Basic#load loaded data} but do not want to allow the
23 * user to edit or submit that value. The value can be optionally {@link #htmlEncode HTML encoded} if it contains
24 * HTML markup that you do not want to be rendered.</p>
25 * <p>If you have more complex content, or need to include components within the displayed content, also
26 * consider using a {@link Ext.form.FieldContainer} instead.</p>
27 * {@img Ext.form.Display/Ext.form.Display.png Ext.form.Display component}
28 * <p>Example:</p>
29 * <pre><code>
30 Ext.create('Ext.form.Panel', {
36 xtype: 'displayfield',
41 xtype: 'displayfield',
42 fieldLabel: 'Visitor',
43 name: 'visitor_score',
49 renderTo: Ext.getBody()
51 </code></pre>
53 Ext.define('Ext.form.field.Display', {
54 extend:'Ext.form.field.Base',
55 alias: 'widget.displayfield',
56 requires: ['Ext.util.Format', 'Ext.XTemplate'],
57 alternateClassName: ['Ext.form.DisplayField', 'Ext.form.Display'],
59 '<div id="{id}" class="{fieldCls}"></div>',
66 <span id='Ext-form-field-Display-cfg-fieldCls'> /**
67 </span> * @cfg {String} fieldCls The default CSS class for the field (defaults to <tt>"x-form-display-field"</tt>)
69 fieldCls: Ext.baseCSSPrefix + 'form-display-field',
71 <span id='Ext-form-field-Display-cfg-htmlEncode'> /**
72 </span> * @cfg {Boolean} htmlEncode <tt>false</tt> to skip HTML-encoding the text when rendering it (defaults to
73 * <tt>false</tt>). This might be useful if you want to include tags in the field's innerHTML rather than
74 * rendering them as string literals per the default logic.
78 validateOnChange: false,
80 initEvents: Ext.emptyFn,
88 validate: function() {
92 getRawValue: function() {
96 setRawValue: function(value) {
98 value = Ext.value(value, '');
101 me.inputEl.dom.innerHTML = me.htmlEncode ? Ext.util.Format.htmlEncode(value) : value;
107 getContentTarget: function() {
111 <span id='Ext-form-field-Display-cfg-inputType'> /**
112 </span> * @cfg {String} inputType
115 <span id='Ext-form-field-Display-cfg-disabled'> /**
116 </span> * @cfg {Boolean} disabled
119 <span id='Ext-form-field-Display-cfg-readOnly'> /**
120 </span> * @cfg {Boolean} readOnly
123 <span id='Ext-form-field-Display-cfg-validateOnChange'> /**
124 </span> * @cfg {Boolean} validateOnChange
127 <span id='Ext-form-field-Display-cfg-checkChangeEvents'> /**
128 </span> * @cfg {Number} checkChangeEvents
131 <span id='Ext-form-field-Display-cfg-checkChangeBuffer'> /**
132 </span> * @cfg {Number} checkChangeBuffer