Upgrade to ExtJS 3.2.0 - Released 03/30/2010
[extjs.git] / docs / source / TextItem.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.2.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.menu.TextItem"></div>/**
16  * @class Ext.menu.TextItem
17  * @extends Ext.menu.BaseItem
18  * Adds a static text string to a menu, usually used as either a heading or group separator.
19  * @constructor
20  * Creates a new TextItem
21  * @param {Object/String} config If config is a string, it is used as the text to display, otherwise it
22  * is applied as a config object (and should contain a <tt>text</tt> property).
23  * @xtype menutextitem
24  */
25 Ext.menu.TextItem = Ext.extend(Ext.menu.BaseItem, {
26     <div id="cfg-Ext.menu.TextItem-text"></div>/**
27      * @cfg {String} text The text to display for this item (defaults to '')
28      */
29     <div id="cfg-Ext.menu.TextItem-hideOnClick"></div>/**
30      * @cfg {Boolean} hideOnClick True to hide the containing menu after this item is clicked (defaults to false)
31      */
32     hideOnClick : false,
33     <div id="cfg-Ext.menu.TextItem-itemCls"></div>/**
34      * @cfg {String} itemCls The default CSS class to use for text items (defaults to "x-menu-text")
35      */
36     itemCls : "x-menu-text",
37     
38     constructor : function(config){
39         if(typeof config == 'string'){
40             config = {text: config}
41         }
42         Ext.menu.TextItem.superclass.constructor.call(this, config);
43     },
44
45     // private
46     onRender : function(){
47         var s = document.createElement("span");
48         s.className = this.itemCls;
49         s.innerHTML = this.text;
50         this.el = s;
51         Ext.menu.TextItem.superclass.onRender.apply(this, arguments);
52     }
53 });
54 Ext.reg('menutextitem', Ext.menu.TextItem);</pre>    
55 </body>
56 </html>