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
17 * {bool} open is the menu open
19 * Create a new Navbar Button
20 * @param {Object} config The config object
22 Roo.bootstrap.NavSidebarItem = function(config){
23 Roo.bootstrap.NavSidebarItem.superclass.constructor.call(this, config);
28 * The raw click event for the entire grid.
29 * @param {Roo.EventObject} e
34 * Fires when the active item active state changes
35 * @param {Roo.bootstrap.NavSidebarItem} this
36 * @param {boolean} state the new state
44 Roo.extend(Roo.bootstrap.NavSidebarItem, Roo.bootstrap.NavItem, {
46 badgeWeight : 'default',
52 getAutoCreate : function(){
57 href : this.href || '#',
69 html : this.html || ''
78 cfg.cls += ' disabled';
81 cfg.cls += ' open x-open';
84 if (this.glyphicon || this.icon) {
85 var c = this.glyphicon ? ('glyphicon glyphicon-'+this.glyphicon) : this.icon;
86 a.cn.push({ tag : 'i', cls : c }) ;
91 if (this.badge !== '') {
93 a.cn.push({ tag: 'span', cls : 'badge pull-right badge-' + this.badgeWeight, html: this.badge });
97 a.cn.push({ tag : 'i', cls : 'glyphicon glyphicon-chevron-down pull-right'});
98 a.cls += 'dropdown-toggle treeview' ;
106 initEvents : function()
108 if (typeof (this.menu) != 'undefined') {
109 this.menu.parentType = this.xtype;
110 this.menu.triggerEl = this.el;
111 this.menu = this.addxtype(Roo.apply({}, this.menu));
114 this.el.on('click', this.onClick, this);
116 if(this.badge !== ''){
118 this.badgeEl = this.el.select('.badge', true).first().setVisibilityMode(Roo.Element.DISPLAY);
123 onClick : function(e)
130 if(this.preventDefault){
134 this.fireEvent('click', this);
139 this.setDisabled(true);
144 this.setDisabled(false);
147 setDisabled : function(state)
149 if(this.disabled == state){
153 this.disabled = state;
156 this.el.addClass('disabled');
160 this.el.removeClass('disabled');
165 setActive : function(state)
167 if(this.active == state){
174 this.el.addClass('active');
178 this.el.removeClass('active');
183 isActive: function ()
188 setBadge : function(str)
194 this.badgeEl.dom.innerHTML = str;