3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
\r
4 <title>The source code</title>
\r
5 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
\r
6 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
\r
8 <body onload="prettyPrint();">
\r
9 <pre class="prettyprint lang-js"><div id="cls-Ext.form.Label"></div>/**
10 * @class Ext.form.Label
11 * @extends Ext.BoxComponent
15 * @param {Ext.Element/String/Object} config The configuration options. If an element is passed, it is set as the internal
16 * element and its id used as the component id. If a string is passed, it is assumed to be the id of an existing element
17 * and is used as the component id. Otherwise, it is assumed to be a standard config object and is applied to the component.
20 Ext.form.Label = Ext.extend(Ext.BoxComponent, {
21 <div id="cfg-Ext.form.Label-text"></div>/**
22 * @cfg {String} text The plain text to display within the label (defaults to ''). If you need to include HTML
23 * tags within the label's innerHTML, use the {@link #html} config instead.
25 <div id="cfg-Ext.form.Label-forId"></div>/**
26 * @cfg {String} forId The id of the input element to which this label will be bound via the standard HTML 'for'
27 * attribute. If not specified, the attribute will not be added to the label.
29 <div id="cfg-Ext.form.Label-html"></div>/**
30 * @cfg {String} html An HTML fragment that will be used as the label's innerHTML (defaults to '').
31 * Note that if {@link #text} is specified it will take precedence and this value will be ignored.
35 onRender : function(ct, position){
37 this.el = document.createElement('label');
38 this.el.id = this.getId();
39 this.el.innerHTML = this.text ? Ext.util.Format.htmlEncode(this.text) : (this.html || '');
41 this.el.setAttribute('for', this.forId);
44 Ext.form.Label.superclass.onRender.call(this, ct, position);
47 <div id="method-Ext.form.Label-setText"></div>/**
48 * Updates the label's innerHTML with the specified string.
49 * @param {String} text The new label text
50 * @param {Boolean} encode (optional) False to skip HTML-encoding the text when rendering it
51 * to the label (defaults to true which encodes the value). This might be useful if you want to include
52 * tags in the label's innerHTML rather than rendering them as string literals per the default logic.
53 * @return {Label} this
55 setText : function(t, encode){
56 var e = encode === false;
57 this[!e ? 'text' : 'html'] = t;
58 delete this[e ? 'text' : 'html'];
60 this.el.dom.innerHTML = encode !== false ? Ext.util.Format.htmlEncode(t) : t;
66 Ext.reg('label', Ext.form.Label);</pre>
\r