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',
50 getAutoCreate : function(){
55 href : this.href || '#',
67 html : this.html || ''
76 cfg.cls += ' disabled';
79 cfg.cls += ' open x-open';
82 if (this.glyphicon || this.icon) {
83 var c = this.glyphicon ? ('glyphicon glyphicon-'+this.glyphicon) : this.icon;
84 a.cn.push({ tag : 'i', cls : c }) ;
89 if (this.badge !== '') {
91 a.cn.push({ tag: 'span', cls : 'badge pull-right badge-' + this.badgeWeight, html: this.badge });
95 a.cn.push({ tag : 'i', cls : 'glyphicon glyphicon-chevron-down pull-right'});
96 a.cls += 'dropdown-toggle treeview' ;
107 initEvents : function()
109 if (typeof (this.menu) != 'undefined') {
110 this.menu.parentType = this.xtype;
111 this.menu.triggerEl = this.el;
112 this.menu = this.addxtype(Roo.apply({}, this.menu));
115 this.el.on('click', this.onClick, this);
118 if(this.badge !== ''){
120 this.badgeEl = this.el.select('.badge', true).first().setVisibilityMode(Roo.Element.DISPLAY);
125 onClick : function(e)
132 if(this.preventDefault){
136 this.fireEvent('click', this);
141 this.setDisabled(true);
146 this.setDisabled(false);
149 setDisabled : function(state)
151 if(this.disabled == state){
155 this.disabled = state;
158 this.el.addClass('disabled');
162 this.el.removeClass('disabled');
167 setActive : function(state)
169 if(this.active == state){
176 this.el.addClass('active');
180 this.el.removeClass('active');
185 isActive: function ()
190 setBadge : function(str)
196 this.badgeEl.dom.innerHTML = str;