]>
Commit | Line | Data |
---|---|---|
6527f429 DM |
1 | /**\r |
2 | * A simple class that renders text directly into a toolbar.\r | |
3 | *\r | |
4 | * @example\r | |
5 | * Ext.create('Ext.panel.Panel', {\r | |
6 | * title: 'Panel with TextItem',\r | |
7 | * width: 300,\r | |
8 | * height: 200,\r | |
9 | * tbar: [\r | |
10 | * { xtype: 'tbtext', html: 'Sample Text Item' }\r | |
11 | * ],\r | |
12 | * renderTo: Ext.getBody()\r | |
13 | * });\r | |
14 | *\r | |
15 | */\r | |
16 | Ext.define('Ext.toolbar.TextItem', {\r | |
17 | extend: 'Ext.toolbar.Item',\r | |
18 | // Toolbar required here because we'll try to decorate it's alternateClassName\r | |
19 | // with this class' alternate name\r | |
20 | requires: ['Ext.toolbar.Toolbar', 'Ext.XTemplate'],\r | |
21 | alias: 'widget.tbtext',\r | |
22 | alternateClassName: 'Ext.Toolbar.TextItem',\r | |
23 | \r | |
24 | /**\r | |
25 | * @cfg {String} text\r | |
26 | * The text to be used as innerHTML (html tags are accepted).\r | |
27 | *\r | |
28 | * @deprecated 5.1.0 Use {@link #html}\r | |
29 | */\r | |
30 | text: '',\r | |
31 | \r | |
32 | baseCls: Ext.baseCSSPrefix + 'toolbar-text',\r | |
33 | \r | |
34 | ariaRole: null,\r | |
35 | \r | |
36 | beforeRender : function() {\r | |
37 | var text = this.text;\r | |
38 | \r | |
39 | this.callParent();\r | |
40 | \r | |
41 | if (text) {\r | |
42 | this.html = text;\r | |
43 | }\r | |
44 | },\r | |
45 | \r | |
46 | /**\r | |
47 | * Updates this item's text, setting the text to be used as innerHTML.\r | |
48 | * @param {String} text The text to display (html accepted).\r | |
49 | *\r | |
50 | * @deprecated 5.1.0 Use {@link #update}\r | |
51 | */\r | |
52 | setText : function(text) {\r | |
53 | this.update(text);\r | |
54 | }\r | |
55 | }); |