source:
trunk/workshop-routing-foss4g/web/ext/src/widgets/form/DisplayField.js
@
81
Revision 76, 2.3 KB checked in by djay, 13 years ago (diff) | |
---|---|
|
Line | |
---|---|
1 | /*! |
2 | * Ext JS Library 3.4.0 |
3 | * Copyright(c) 2006-2011 Sencha Inc. |
4 | * licensing@sencha.com |
5 | * http://www.sencha.com/license |
6 | */ |
7 | /** |
8 | * @class Ext.form.DisplayField |
9 | * @extends Ext.form.Field |
10 | * A display-only text field which is not validated and not submitted. |
11 | * @constructor |
12 | * Creates a new DisplayField. |
13 | * @param {Object} config Configuration options |
14 | * @xtype displayfield |
15 | */ |
16 | Ext.form.DisplayField = Ext.extend(Ext.form.Field, { |
17 | validationEvent : false, |
18 | validateOnBlur : false, |
19 | defaultAutoCreate : {tag: "div"}, |
20 | /** |
21 | * @cfg {String} fieldClass The default CSS class for the field (defaults to <tt>"x-form-display-field"</tt>) |
22 | */ |
23 | fieldClass : "x-form-display-field", |
24 | /** |
25 | * @cfg {Boolean} htmlEncode <tt>false</tt> to skip HTML-encoding the text when rendering it (defaults to |
26 | * <tt>false</tt>). This might be useful if you want to include tags in the field's innerHTML rather than |
27 | * rendering them as string literals per the default logic. |
28 | */ |
29 | htmlEncode: false, |
30 | |
31 | // private |
32 | initEvents : Ext.emptyFn, |
33 | |
34 | isValid : function(){ |
35 | return true; |
36 | }, |
37 | |
38 | validate : function(){ |
39 | return true; |
40 | }, |
41 | |
42 | getRawValue : function(){ |
43 | var v = this.rendered ? this.el.dom.innerHTML : Ext.value(this.value, ''); |
44 | if(v === this.emptyText){ |
45 | v = ''; |
46 | } |
47 | if(this.htmlEncode){ |
48 | v = Ext.util.Format.htmlDecode(v); |
49 | } |
50 | return v; |
51 | }, |
52 | |
53 | getValue : function(){ |
54 | return this.getRawValue(); |
55 | }, |
56 | |
57 | getName: function() { |
58 | return this.name; |
59 | }, |
60 | |
61 | setRawValue : function(v){ |
62 | if(this.htmlEncode){ |
63 | v = Ext.util.Format.htmlEncode(v); |
64 | } |
65 | return this.rendered ? (this.el.dom.innerHTML = (Ext.isEmpty(v) ? '' : v)) : (this.value = v); |
66 | }, |
67 | |
68 | setValue : function(v){ |
69 | this.setRawValue(v); |
70 | return this; |
71 | } |
72 | /** |
73 | * @cfg {String} inputType |
74 | * @hide |
75 | */ |
76 | /** |
77 | * @cfg {Boolean} disabled |
78 | * @hide |
79 | */ |
80 | /** |
81 | * @cfg {Boolean} readOnly |
82 | * @hide |
83 | */ |
84 | /** |
85 | * @cfg {Boolean} validateOnBlur |
86 | * @hide |
87 | */ |
88 | /** |
89 | * @cfg {Number} validationDelay |
90 | * @hide |
91 | */ |
92 | /** |
93 | * @cfg {String/Boolean} validationEvent |
94 | * @hide |
95 | */ |
96 | }); |
97 | |
98 | Ext.reg('displayfield', Ext.form.DisplayField); |
Note: See TracBrowser
for help on using the repository browser.