initial import
[roojs1] / Roo / menu / TextItem.js
1 /*
2  * Based on:
3  * Ext JS Library 1.1.1
4  * Copyright(c) 2006-2007, Ext JS, LLC.
5  *
6  * Originally Released Under LGPL - original licence link has changed is not relivant.
7  *
8  * Fork - LGPL
9  * <script type="text/javascript">
10  */
11
12 /**
13  * @class Roo.menu.TextItem
14  * @extends Roo.menu.BaseItem
15  * Adds a static text string to a menu, usually used as either a heading or group separator.
16  * @constructor
17  * Creates a new TextItem
18  * @param {String} text The text to display
19  */
20 Roo.menu.TextItem = function(text){
21     this.text = text;
22     Roo.menu.TextItem.superclass.constructor.call(this);
23 };
24
25 Roo.extend(Roo.menu.TextItem, Roo.menu.BaseItem, {
26     /**
27      * @cfg {Boolean} hideOnClick True to hide the containing menu after this item is clicked (defaults to false)
28      */
29     hideOnClick : false,
30     /**
31      * @cfg {String} itemCls The default CSS class to use for text items (defaults to "x-menu-text")
32      */
33     itemCls : "x-menu-text",
34
35     // private
36     onRender : function(){
37         var s = document.createElement("span");
38         s.className = this.itemCls;
39         s.innerHTML = this.text;
40         this.el = s;
41         Roo.menu.TextItem.superclass.onRender.apply(this, arguments);
42     }
43 });