From 92722595d15e9b91056ff25b96d6a23d1cbe06c2 Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Fri, 16 May 2014 16:29:43 +0800 Subject: [PATCH] Roo/bootstrap/Button.js --- Roo/bootstrap/Button.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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 -- 2.39.2