13 * @class Roo.bootstrap.nav.SidebarItem
14 * @extends Roo.bootstrap.nav.Item
15 * Bootstrap Navbar.NavSidebarItem class
17 * {String} badgeWeight (default|primary|success|info|warning|danger)the extra classes for the badge
18 * {Boolean} open is the menu open
19 * {Boolean} buttonView use button as the tigger el rather that a (default false)
20 * {String} buttonWeight (default|primary|success|info|warning|danger)the extra classes for the button
21 * {String} buttonSize (sm|md|lg)the extra classes for the button
22 * {Boolean} showArrow show arrow next to the text (default true)
24 * Create a new Navbar Button
25 * @param {Object} config The config object
27 Roo.bootstrap.nav.SidebarItem = function(config){
28 Roo.bootstrap.nav.SidebarItem.superclass.constructor.call(this, config);
33 * The raw click event for the entire grid.
34 * @param {Roo.EventObject} e
39 * Fires when the active item active state changes
40 * @param {Roo.bootstrap.nav.SidebarItem} this
41 * @param {boolean} state the new state
49 Roo.extend(Roo.bootstrap.nav.SidebarItem, Roo.bootstrap.nav.Item, {
51 badgeWeight : 'default',
57 buttonWeight : 'default',
63 getAutoCreate : function(){
68 href : this.href || '#',
77 href : this.href || '#',
78 cls: 'btn btn-' + this.buttonWeight + ' btn-' + this.buttonSize + 'roo-button-dropdown-toggle',
95 cfg.cls += ' disabled';
98 cfg.cls += ' open x-open';
101 if (this.glyphicon || this.icon) {
102 var c = this.glyphicon ? ('glyphicon glyphicon-'+this.glyphicon) : this.icon;
103 a.cn.push({ tag : 'i', cls : c }) ;
106 if(!this.buttonView){
109 html : this.html || ''
116 if (this.badge !== '') {
117 a.cn.push({ tag: 'span', cls : 'badge pull-right badge-' + this.badgeWeight, html: this.badge });
123 a.cn.push({ tag : 'i', cls : 'glyphicon glyphicon-chevron-down pull-right'});
126 a.cls += ' dropdown-toggle treeview' ;
132 initEvents : function()
134 if (typeof (this.menu) != 'undefined') {
135 this.menu.parentType = this.xtype;
136 this.menu.triggerEl = this.el;
137 this.menu = this.addxtype(Roo.apply({}, this.menu));
140 this.el.on('click', this.onClick, this);
142 if(this.badge !== ''){
143 this.badgeEl = this.el.select('.badge', true).first().setVisibilityMode(Roo.Element.DISPLAY);
148 onClick : function(e)
155 if(this.preventDefault){
159 this.fireEvent('click', this, e);
164 this.setDisabled(true);
169 this.setDisabled(false);
172 setDisabled : function(state)
174 if(this.disabled == state){
178 this.disabled = state;
181 this.el.addClass('disabled');
185 this.el.removeClass('disabled');
190 setActive : function(state)
192 if(this.active == state){
199 this.el.addClass('active');
203 this.el.removeClass('active');
208 isActive: function ()
213 setBadge : function(str)
219 this.badgeEl.dom.innerHTML = str;