Upgrade to ExtJS 3.3.0 - Released 10/06/2010
[extjs.git] / docs / source / DisplayField.html
1 <html>
2 <head>
3   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />    
4   <title>The source code</title>
5     <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
6     <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
7 </head>
8 <body  onload="prettyPrint();">
9     <pre class="prettyprint lang-js">/*!
10  * Ext JS Library 3.3.0
11  * Copyright(c) 2006-2010 Ext JS, Inc.
12  * licensing@extjs.com
13  * http://www.extjs.com/license
14  */
15 <div id="cls-Ext.form.DisplayField"></div>/**
16  * @class Ext.form.DisplayField
17  * @extends Ext.form.Field
18  * A display-only text field which is not validated and not submitted.
19  * @constructor
20  * Creates a new DisplayField.
21  * @param {Object} config Configuration options
22  * @xtype displayfield
23  */
24 Ext.form.DisplayField = Ext.extend(Ext.form.Field,  {
25     validationEvent : false,
26     validateOnBlur : false,
27     defaultAutoCreate : {tag: "div"},
28     <div id="cfg-Ext.form.DisplayField-fieldClass"></div>/**
29      * @cfg {String} fieldClass The default CSS class for the field (defaults to <tt>"x-form-display-field"</tt>)
30      */
31     fieldClass : "x-form-display-field",
32     <div id="cfg-Ext.form.DisplayField-htmlEncode"></div>/**
33      * @cfg {Boolean} htmlEncode <tt>false</tt> to skip HTML-encoding the text when rendering it (defaults to
34      * <tt>false</tt>). This might be useful if you want to include tags in the field's innerHTML rather than
35      * rendering them as string literals per the default logic.
36      */
37     htmlEncode: false,
38
39     // private
40     initEvents : Ext.emptyFn,
41
42     isValid : function(){
43         return true;
44     },
45
46     validate : function(){
47         return true;
48     },
49
50     getRawValue : function(){
51         var v = this.rendered ? this.el.dom.innerHTML : Ext.value(this.value, '');
52         if(v === this.emptyText){
53             v = '';
54         }
55         if(this.htmlEncode){
56             v = Ext.util.Format.htmlDecode(v);
57         }
58         return v;
59     },
60
61     getValue : function(){
62         return this.getRawValue();
63     },
64     
65     getName: function() {
66         return this.name;
67     },
68
69     setRawValue : function(v){
70         if(this.htmlEncode){
71             v = Ext.util.Format.htmlEncode(v);
72         }
73         return this.rendered ? (this.el.dom.innerHTML = (Ext.isEmpty(v) ? '' : v)) : (this.value = v);
74     },
75
76     setValue : function(v){
77         this.setRawValue(v);
78         return this;
79     }
80     <div id="cfg-Ext.form.DisplayField-inputType"></div>/** 
81      * @cfg {String} inputType 
82      * @hide
83      */
84     <div id="cfg-Ext.form.DisplayField-disabled"></div>/** 
85      * @cfg {Boolean} disabled 
86      * @hide
87      */
88     <div id="cfg-Ext.form.DisplayField-readOnly"></div>/** 
89      * @cfg {Boolean} readOnly 
90      * @hide
91      */
92     <div id="cfg-Ext.form.DisplayField-validateOnBlur"></div>/** 
93      * @cfg {Boolean} validateOnBlur 
94      * @hide
95      */
96     <div id="cfg-Ext.form.DisplayField-validationDelay"></div>/** 
97      * @cfg {Number} validationDelay 
98      * @hide
99      */
100     <div id="cfg-Ext.form.DisplayField-validationEvent"></div>/** 
101      * @cfg {String/Boolean} validationEvent 
102      * @hide
103      */
104 });
105
106 Ext.reg('displayfield', Ext.form.DisplayField);
107 </pre>    
108 </body>
109 </html>