* @cfg {String} badge text for badge
* @cfg {String} theme default
* @cfg {Boolean} inverse
- * @cfg {Boolean} toggle
+ * @cfg {Boolean} toggle is it a slidy toggle button
+ * @cfg {Boolean} pressed (true|false) default null - if the button ahs active state
* @cfg {String} ontext text for on toggle state
* @cfg {String} offtext text for off toggle state
* @cfg {Boolean} defaulton
/**
* @event click
* When a butotn is pressed
- * @param {Roo.bootstrap.Button} this
+ * @param {Roo.bootstrap.Button} btn
* @param {Roo.EventObject} e
*/
"click" : true,
/**
* @event toggle
* After the button has been toggles
+ * @param {Roo.bootstrap.Button} btn
* @param {Roo.EventObject} e
* @param {boolean} pressed (also available as button.pressed)
*/
}
- if (this.active) {
+ if (this.active || this.pressed === true) {
cfg.cls += ' active';
}
setActive : function(v) {
this.el[v ? 'addClass' : 'removeClass']('active');
+ this.pressed = v;
},
/**
* toggles the current active state
{
return this.el.hasClass('active');
},
- }
+ /**
+ * set the text of the first selected button
+ */
setText : function(str)
{
this.el.select('.roo-button-text',true).first().dom.innerHTML = str;
},
+ /**
+ * get the text of the first selected button
+ */
getText : function()
{
return this.el.select('.roo-button-text',true).first().dom.innerHTML;
},
setWeight : function(str)
{
- this.el.removeClass(this.weightClass);
+ this.el.removeClass(this.weightClass);
this.el.addClass('btn-' + str);
}