Upgrade to ExtJS 4.0.2 - Released 06/09/2011
[extjs.git] / docs / source / TextItem.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5   <title>The source code</title>
6   <link href="../prettify/prettify.css" type="text/css" rel="stylesheet" />
7   <script type="text/javascript" src="../prettify/prettify.js"></script>
8   <style type="text/css">
9     .highlight { display: block; background-color: #ddd; }
10   </style>
11   <script type="text/javascript">
12     function highlight() {
13       document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
14     }
15   </script>
16 </head>
17 <body onload="prettyPrint(); highlight();">
18   <pre class="prettyprint lang-js"><span id='Ext-toolbar-TextItem-method-constructor'><span id='Ext-toolbar-TextItem'>/**
19 </span></span> * @class Ext.toolbar.TextItem
20  * @extends Ext.toolbar.Item
21  *
22  * A simple class that renders text directly into a toolbar.
23  *
24  * ## Example usage
25  *
26  * {@img Ext.toolbar.TextItem/Ext.toolbar.TextItem.png TextItem component}
27  *
28  *      Ext.create('Ext.panel.Panel', {
29  *          title: 'Panel with TextItem',
30  *          width: 300,
31  *          height: 200,
32  *          tbar: [
33  *              {xtype: 'tbtext', text: 'Sample TextItem'}
34  *          ],
35  *          renderTo: Ext.getBody()
36  *      });
37  *
38  * @constructor
39  * Creates a new TextItem
40  * @param {Object} text A text string, or a config object containing a &lt;tt&gt;text&lt;/tt&gt; property
41  */
42 Ext.define('Ext.toolbar.TextItem', {
43     extend: 'Ext.toolbar.Item',
44     requires: ['Ext.XTemplate'],
45     alias: 'widget.tbtext',
46     alternateClassName: 'Ext.Toolbar.TextItem',
47     
48 <span id='Ext-toolbar-TextItem-cfg-text'>    /**
49 </span>     * @cfg {String} text The text to be used as innerHTML (html tags are accepted)
50      */
51     text: '',
52     
53     renderTpl: '{text}',
54     //
55     baseCls: Ext.baseCSSPrefix + 'toolbar-text',
56     
57     onRender : function() {
58         Ext.apply(this.renderData, {
59             text: this.text
60         });
61         this.callParent(arguments);
62     },
63
64 <span id='Ext-toolbar-TextItem-method-setText'>    /**
65 </span>     * Updates this item's text, setting the text to be used as innerHTML.
66      * @param {String} t The text to display (html accepted).
67      */
68     setText : function(t) {
69         if (this.rendered) {
70             this.el.update(t);
71             this.ownerCt.doLayout(); // In case an empty text item (centered at zero height) receives new text.
72         } else {
73             this.text = t;
74         }
75     }
76 });</pre>
77 </body>
78 </html>