13 * @class Roo.bootstrap.NavSidebarItem
14 * @extends Roo.bootstrap.NavItem
15 * Bootstrap Navbar.NavSidebarItem class
16 * {String} badgeWeight (default|primary|success|info|warning|danger)the extra classes for the badge
18 * Create a new Navbar Button
19 * @param {Object} config The config object
21 Roo.bootstrap.NavSidebarItem = function(config){
22 Roo.bootstrap.NavSidebarItem.superclass.constructor.call(this, config);
27 * The raw click event for the entire grid.
28 * @param {Roo.EventObject} e
33 * Fires when the active item active state changes
34 * @param {Roo.bootstrap.NavSidebarItem} this
35 * @param {boolean} state the new state
43 Roo.extend(Roo.bootstrap.NavSidebarItem, Roo.bootstrap.NavItem, {
45 badgeWeight : 'default',
47 getAutoCreate : function(){
52 href : this.href || '#',
64 html : this.html || ''
73 cfg.cls += ' disabled';
77 if (this.glyphicon || this.icon) {
78 var c = this.glyphicon ? ('glyphicon glyphicon-'+this.glyphicon) : this.icon;
79 a.cn.push({ tag : 'i', cls : c }) ;
84 if (this.badge !== '') {
86 a.cn.push({ tag: 'span', cls : 'badge pull-right badge-' + this.badgeWeight, html: this.badge });
90 a.cn.push({ tag : 'i', cls : 'glyphicon glyphicon-chevron-down pull-right'});
91 a.cls += 'dropdown-toggle treeview' ;
102 initEvents : function()
104 this.el.on('click', this.onClick, this);
107 if(this.badge !== ''){
109 this.badgeEl = this.el.select('.badge', true).first().setVisibilityMode(Roo.Element.DISPLAY);
114 onClick : function(e)
121 if(this.preventDefault){
125 this.fireEvent('click', this);
130 this.setDisabled(true);
135 this.setDisabled(false);
138 setDisabled : function(state)
140 if(this.disabled == state){
144 this.disabled = state;
147 this.el.addClass('disabled');
151 this.el.removeClass('disabled');
156 setActive : function(state)
158 if(this.active == state){
165 this.el.addClass('active');
169 this.el.removeClass('active');
174 isActive: function ()
179 setBadge : function(str)
185 this.badgeEl.dom.innerHTML = str;