3 <title>The source code</title>
4 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
5 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
7 <body onload="prettyPrint();">
8 <pre class="prettyprint lang-js">/*!
10 * Copyright(c) 2006-2009 Ext JS, LLC
12 * http://www.extjs.com/license
14 <div id="cls-Ext.form.DisplayField"></div>/**
\r
15 * @class Ext.form.DisplayField
\r
16 * @extends Ext.form.Field
\r
17 * A display-only text field which is not validated and not submitted.
\r
19 * Creates a new DisplayField.
\r
20 * @param {Object} config Configuration options
\r
21 * @xtype displayfield
\r
23 Ext.form.DisplayField = Ext.extend(Ext.form.Field, {
\r
24 validationEvent : false,
\r
25 validateOnBlur : false,
\r
26 defaultAutoCreate : {tag: "div"},
\r
27 <div id="cfg-Ext.form.DisplayField-fieldClass"></div>/**
\r
28 * @cfg {String} fieldClass The default CSS class for the field (defaults to <tt>"x-form-display-field"</tt>)
\r
30 fieldClass : "x-form-display-field",
\r
31 <div id="cfg-Ext.form.DisplayField-htmlEncode"></div>/**
\r
32 * @cfg {Boolean} htmlEncode <tt>false</tt> to skip HTML-encoding the text when rendering it (defaults to
\r
33 * <tt>false</tt>). This might be useful if you want to include tags in the field's innerHTML rather than
\r
34 * rendering them as string literals per the default logic.
\r
39 initEvents : Ext.emptyFn,
\r
41 isValid : function(){
\r
45 validate : function(){
\r
49 getRawValue : function(){
\r
50 var v = this.rendered ? this.el.dom.innerHTML : Ext.value(this.value, '');
\r
51 if(v === this.emptyText){
\r
54 if(this.htmlEncode){
\r
55 v = Ext.util.Format.htmlDecode(v);
\r
60 getValue : function(){
\r
61 return this.getRawValue();
\r
64 getName: function() {
\r
68 setRawValue : function(v){
\r
69 if(this.htmlEncode){
\r
70 v = Ext.util.Format.htmlEncode(v);
\r
72 return this.rendered ? (this.el.dom.innerHTML = (Ext.isEmpty(v) ? '' : v)) : (this.value = v);
\r
75 setValue : function(v){
\r
76 this.setRawValue(v);
\r
79 <div id="cfg-Ext.form.DisplayField-inputType"></div>/**
\r
80 * @cfg {String} inputType
\r
83 <div id="cfg-Ext.form.DisplayField-disabled"></div>/**
\r
84 * @cfg {Boolean} disabled
\r
87 <div id="cfg-Ext.form.DisplayField-readOnly"></div>/**
\r
88 * @cfg {Boolean} readOnly
\r
91 <div id="cfg-Ext.form.DisplayField-validateOnBlur"></div>/**
\r
92 * @cfg {Boolean} validateOnBlur
\r
95 <div id="cfg-Ext.form.DisplayField-validationDelay"></div>/**
\r
96 * @cfg {Number} validationDelay
\r
99 <div id="cfg-Ext.form.DisplayField-validationEvent"></div>/**
\r
100 * @cfg {String/Boolean} validationEvent
\r
105 Ext.reg('displayfield', Ext.form.DisplayField);
\r