From 6f4f9538e7b21526daa7b20502f10b14f80da7af Mon Sep 17 00:00:00 2001 From: Alan Date: Tue, 15 Mar 2022 15:21:59 +0800 Subject: [PATCH] Roo/Button.js --- Roo/Button.js | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/Roo/Button.js b/Roo/Button.js index 4d4ddf22d2..c3cc8d6ee8 100644 --- a/Roo/Button.js +++ b/Roo/Button.js @@ -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 */ -- 2.39.2