Roo/Button.js
authorAlan <alan@roojs.com>
Tue, 15 Mar 2022 07:21:59 +0000 (15:21 +0800)
committerAlan <alan@roojs.com>
Tue, 15 Mar 2022 07:21:59 +0000 (15:21 +0800)
Roo/Button.js

index 4d4ddf2..c3cc8d6 100644 (file)
@@ -369,7 +369,24 @@ Roo.extend(Roo.Button, Roo.util.Observable, {
             this.hide();
         }
     },
-    
+    /**
+        * Similar to toggle, but does not trigger event.
+        * @param {Boolean} state [required] Force a particular state
+        */
+       setPressed : function(state)
+       {
+        
+        if(state != this.pressed){
+            if(state){
+                this.el.addClass("x-btn-pressed");
+                this.pressed = true;
+            }else{
+                this.el.removeClass("x-btn-pressed");
+                this.pressed = false;
+            }
+        }
+       }
+       
     /**
      * If a state it passed, it becomes the pressed state otherwise the current state is toggled.
      * @param {Boolean} state (optional) Force a particular state
@@ -392,6 +409,8 @@ Roo.extend(Roo.Button, Roo.util.Observable, {
         }
     },
     
+       
+       
     /**
      * Focus the button
      */