// raw events
/**
* @event click
- * The raw click event for the entire grid.
+ * When a butotn is pressed
* @param {Roo.EventObject} e
*/
- "click" : true
+ "click" : true,
+ /**
+ * @event toggle
+ * After the button has been toggles
+ * @param {Roo.EventObject} e
+ */
+ "toggle" : true
});
};
name: false,
target: false,
+
+ pressed : null,
+
+
getAutoCreate : function(){
var cfg = {
}
cfg.html = this.html || cfg.html;
- if (this.toggle===true) {
+ if (this.toggle === true) {
cfg={
tag: 'div',
cls: 'slider-frame roo-button',
if (this.theme==='default') {
cfg.cls = 'btn roo-button';
- if (this.parentType != 'Navbar') {
- this.weight = this.weight.length ? this.weight : 'default';
- }
+ //if (this.parentType != 'Navbar') {
+ this.weight = this.weight.length ? this.weight : 'default';
+ //}
if (['default', 'primary', 'success', 'info', 'warning', 'danger', 'link'].indexOf(this.weight) > -1) {
cfg.cls += ' btn-' + this.weight;
delete cfg.html;
- }
+ }
+
+ cfg.cls += this.parentType === 'Navbar' ? ' navbar-btn' : '';
if (this.glyphicon) {
cfg.html = ' ' + cfg.html;
if(this.preventDefault){
e.preventDefault();
}
+ if (this.pressed === true || this.pressed === false) {
+ this.pressed = !this.pressed;
+ this[this.pressed ? 'addClass' : 'removeClass']('active');
+ this.fireEvent('toggle', this,e);
+ }
+
this.fireEvent('click', this, e);
}