Roo/bootstrap/Button.js
[roojs1] / Roo / bootstrap / Button.js
index 6a19e08..da96380 100644 (file)
@@ -97,7 +97,7 @@ Roo.extend(Roo.bootstrap.Button, Roo.bootstrap.Component,  {
         }
         cfg.html = this.html || cfg.html;
         
-        if (this.toggle === true) {
+        if (this.toggle == true) {
             cfg={
                 tag: 'div',
                 cls: 'slider-frame roo-button',
@@ -302,6 +302,29 @@ Roo.extend(Roo.bootstrap.Button, Roo.bootstrap.Component,  {
         this.disabled = true;
         this.el.addClass('disabled');
     },
+     /**
+     * sets the active state on/off, 
+     * @param {Boolean} state (optional) Force a particular state
+     */
+    setActive : function(v) {
+        
+        this.el[v ? 'addClass' : 'removeClass']('active');
+        
+        
+    },
+     /**
+     * If a state it passed, it becomes the pressed state otherwise the current state is toggled.
+     * @param {Boolean} state (optional) Force a particular state
+     */
+    toggleActive : function(v)
+    {
+       var active = this.el.hasClass('active');
+       this.setActive(!active);
+       
+        
+    }
+    
+    
     
 });