2 * @class Ext.form.field.Display
3 * @extends Ext.form.field.Base
4 * <p>A display-only text field which is not validated and not submitted. This is useful for when you want
5 * to display a value from a form's {@link Ext.form.Basic#load loaded data} but do not want to allow the
6 * user to edit or submit that value. The value can be optionally {@link #htmlEncode HTML encoded} if it contains
7 * HTML markup that you do not want to be rendered.</p>
8 * <p>If you have more complex content, or need to include components within the displayed content, also
9 * consider using a {@link Ext.form.FieldContainer} instead.</p>
10 * {@img Ext.form.Display/Ext.form.Display.png Ext.form.Display component}
13 Ext.create('Ext.form.Panel', {
19 xtype: 'displayfield',
24 xtype: 'displayfield',
25 fieldLabel: 'Visitor',
26 name: 'visitor_score',
32 renderTo: Ext.getBody()
37 * Creates a new DisplayField.
38 * @param {Object} config Configuration options
42 Ext.define('Ext.form.field.Display', {
43 extend:'Ext.form.field.Base',
44 alias: 'widget.displayfield',
45 requires: ['Ext.util.Format', 'Ext.XTemplate'],
46 alternateClassName: ['Ext.form.DisplayField', 'Ext.form.Display'],
48 '<div id="{id}" class="{fieldCls}"></div>',
56 * @cfg {String} fieldCls The default CSS class for the field (defaults to <tt>"x-form-display-field"</tt>)
58 fieldCls: Ext.baseCSSPrefix + 'form-display-field',
61 * @cfg {Boolean} htmlEncode <tt>false</tt> to skip HTML-encoding the text when rendering it (defaults to
62 * <tt>false</tt>). This might be useful if you want to include tags in the field's innerHTML rather than
63 * rendering them as string literals per the default logic.
67 validateOnChange: false,
69 initEvents: Ext.emptyFn,
77 validate: function() {
81 getRawValue: function() {
85 setRawValue: function(value) {
87 value = Ext.value(value, '');
90 me.inputEl.dom.innerHTML = me.htmlEncode ? Ext.util.Format.htmlEncode(value) : value;
96 getContentTarget: function() {
101 * @cfg {String} inputType
105 * @cfg {Boolean} disabled
109 * @cfg {Boolean} readOnly
113 * @cfg {Boolean} validateOnChange
117 * @cfg {Number} checkChangeEvents
121 * @cfg {Number} checkChangeBuffer