source:
trunk/workshop-routing-foss4g/web/ext/src/widgets/menu/TextItem.js
@
78
Revision 76, 1.5 KB checked in by djay, 13 years ago (diff) | |
---|---|
|
Line | |
---|---|
1 | /*! |
2 | * Ext JS Library 3.4.0 |
3 | * Copyright(c) 2006-2011 Sencha Inc. |
4 | * licensing@sencha.com |
5 | * http://www.sencha.com/license |
6 | */ |
7 | /** |
8 | * @class Ext.menu.TextItem |
9 | * @extends Ext.menu.BaseItem |
10 | * Adds a static text string to a menu, usually used as either a heading or group separator. |
11 | * @constructor |
12 | * Creates a new TextItem |
13 | * @param {Object/String} config If config is a string, it is used as the text to display, otherwise it |
14 | * is applied as a config object (and should contain a <tt>text</tt> property). |
15 | * @xtype menutextitem |
16 | */ |
17 | Ext.menu.TextItem = Ext.extend(Ext.menu.BaseItem, { |
18 | /** |
19 | * @cfg {String} text The text to display for this item (defaults to '') |
20 | */ |
21 | /** |
22 | * @cfg {Boolean} hideOnClick True to hide the containing menu after this item is clicked (defaults to false) |
23 | */ |
24 | hideOnClick : false, |
25 | /** |
26 | * @cfg {String} itemCls The default CSS class to use for text items (defaults to "x-menu-text") |
27 | */ |
28 | itemCls : "x-menu-text", |
29 | |
30 | constructor : function(config) { |
31 | if (typeof config == 'string') { |
32 | config = { |
33 | text: config |
34 | }; |
35 | } |
36 | Ext.menu.TextItem.superclass.constructor.call(this, config); |
37 | }, |
38 | |
39 | // private |
40 | onRender : function() { |
41 | var s = document.createElement("span"); |
42 | s.className = this.itemCls; |
43 | s.innerHTML = this.text; |
44 | this.el = s; |
45 | Ext.menu.TextItem.superclass.onRender.apply(this, arguments); |
46 | } |
47 | }); |
48 | Ext.reg('menutextitem', Ext.menu.TextItem); |
Note: See TracBrowser
for help on using the repository browser.