Roo/bootstrap/Button.js
[roojs1] / Roo / bootstrap / Button.js
index a7c33aa..20d6545 100644 (file)
@@ -95,7 +95,7 @@ Roo.extend(Roo.bootstrap.Button, Roo.bootstrap.Component,  {
         } else {
             cfg.tag = this.tag;
         }
-        cfg.html = this.html || cfg.html;
+        cfg.html = '<span class="roo-button-text">' + (this.html || cfg.html) + '</span>';
         
         if (this.toggle == true) {
             cfg={
@@ -167,7 +167,7 @@ Roo.extend(Roo.bootstrap.Button, Roo.bootstrap.Component,  {
         
         if (this.items) {
             Roo.log('changing to ul' );
-            cfg.tag = 'ul';
+            cfg.tag = 'div';
             this.glyphicon = 'caret';
         }
         
@@ -264,12 +264,25 @@ Roo.extend(Roo.bootstrap.Button, Roo.bootstrap.Component,  {
     initEvents: function() {
        // Roo.log('init events?');
 //        Roo.log(this.el.dom);
+        // add the menu...
+        
+        if (typeof (this.menu) != 'undefined') {
+            this.menu.parentType = this.xtype;
+            this.menu.triggerEl = this.el;
+            this.addxtype(Roo.apply({}, this.menu));
+        }
+
+
        if (this.el.hasClass('roo-button')) {
             this.el.on('click', this.onClick, this);
        } else {
             this.el.select('.roo-button').on('click', this.onClick, this);
        }
        
+       if(this.removeClass){
+           this.el.on('click', this.onClick, this);
+       }
+       
        this.el.enableDisplayMode();
         
     },
@@ -332,6 +345,10 @@ Roo.extend(Roo.bootstrap.Button, Roo.bootstrap.Component,  {
     {
         this.el.select('.roo-button-text',true).first().dom.innerHTML = str;
     },
+    getText : function()
+    {
+        return this.el.select('.roo-button-text',true).first().dom.innerHTML;
+    },
     hide: function() {