Roo/bootstrap/Button.js
[roojs1] / Roo / bootstrap / Button.js
index e925a30..3950538 100644 (file)
@@ -86,9 +86,8 @@ Roo.extend(Roo.bootstrap.Button, Roo.bootstrap.Component,  {
     removeClass: false,
     name: false,
     target: false,
-    
-    
-    pressed : null,
+     
+    pressed : false,
      
     
     getAutoCreate : function(){
@@ -252,7 +251,8 @@ Roo.extend(Roo.bootstrap.Button, Roo.bootstrap.Component,  {
         
         if (this.menu) {
             cfg.cls += ' dropdown';
-            cfg.html = typeof(cfg.html) != 'undefined' ? cfg.html + ' <span class="caret"></span>' : '<span class="caret"></span>';
+            cfg.html = typeof(cfg.html) != 'undefined' ?
+                    cfg.html + ' <span class="caret"></span>' : '<span class="caret"></span>';
         }
         
         if (cfg.tag !== 'a' && this.href !== '') {
@@ -309,9 +309,7 @@ Roo.extend(Roo.bootstrap.Button, Roo.bootstrap.Component,  {
         }
         
         if (this.pressed === true || this.pressed === false) {
-            this.pressed = !this.pressed;
-            this.el[this.pressed ? 'addClass' : 'removeClass']('active');
-            this.fireEvent('toggle', this, e, this.pressed);
+            this.toggleActive();
         }
         
         
@@ -349,10 +347,7 @@ Roo.extend(Roo.bootstrap.Button, Roo.bootstrap.Component,  {
      */
     toggleActive : function()
     {
-       var active = this.el.hasClass('active');
-       this.setActive(!active);
-       
-        
+        this.setActive(this.pressed);
     },
      /**
      * get the current active state