Roo/menu/TextItem.js
authorAlan Knowles <alan@akbkhome.com>
Thu, 29 Jul 2010 09:45:02 +0000 (17:45 +0800)
committerAlan Knowles <alan@akbkhome.com>
Thu, 29 Jul 2010 09:45:02 +0000 (17:45 +0800)
Roo/menu/TextItem.js

index 765ed1f..ead6924 100644 (file)
  * @class Roo.menu.TextItem
  * @extends Roo.menu.BaseItem
  * Adds a static text string to a menu, usually used as either a heading or group separator.
+ * Note: old style constructor with text is still supported.
+ * 
  * @constructor
  * Creates a new TextItem
- * @param {String} text The text to display
+ * @param {Object} cfg Configuration
  */
 Roo.menu.TextItem = function(text){
-    this.text = text;
+    if (typeof(text) == 'string') {
+        this.text = text;
+    } else {
+        Roo.apply(this,text
+    }
+    
     Roo.menu.TextItem.superclass.constructor.call(this);
 };
 
 Roo.extend(Roo.menu.TextItem, Roo.menu.BaseItem, {
+    /**
+     * @cfg {Boolean} text Text to show on item.
+     */
+    text : '',
+    
     /**
      * @cfg {Boolean} hideOnClick True to hide the containing menu after this item is clicked (defaults to false)
      */