From: Alan Knowles Date: Fri, 16 May 2014 08:29:43 +0000 (+0800) Subject: Roo/bootstrap/Button.js X-Git-Url: http://git.roojs.org/?p=roojs1;a=commitdiff_plain;h=92722595d15e9b91056ff25b96d6a23d1cbe06c2 Roo/bootstrap/Button.js --- diff --git a/Roo/bootstrap/Button.js b/Roo/bootstrap/Button.js index 25b46dd6a8..da963809d7 100644 --- a/Roo/bootstrap/Button.js +++ b/Roo/bootstrap/Button.js @@ -302,12 +302,30 @@ 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); + + } + + + }); \ No newline at end of file