From: Alan Date: Tue, 15 Mar 2022 07:21:59 +0000 (+0800) Subject: Roo/Button.js X-Git-Url: http://git.roojs.org/?p=roojs1;a=commitdiff_plain;h=6f4f9538e7b21526daa7b20502f10b14f80da7af Roo/Button.js --- 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 */