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' ;
103 onClick : function(e)
110 if(this.preventDefault){
114 this.fireEvent('click', this);
119 this.setDisabled(true);
124 this.setDisabled(false);
127 setDisabled : function(state)
129 if(this.disabled == state){
133 this.disabled = state;
136 this.el.addClass('disabled');
140 this.el.removeClass('disabled');
145 setActive : function(state)
147 if(this.active == state){
154 this.el.addClass('active');
158 this.el.removeClass('active');
163 isActive: function ()
168 setBadge : function(str)
174 this.badgeEl.dom.innerHTML = str;
179 initEvents : function()
181 this.el.on('click', this.onClick, this);
184 if(this.badge !== ''){
186 this.badgeEl = this.el.select('.badge', true).first().setVisibilityMode(Roo.Element.DISPLAY);