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' ;
104 initEvents : function()
106 Roo.log('NavSidebarItem initEvents??');
108 Roo.log(typeof(this.menu));
110 if (typeof (this.menu) != 'undefined') {
111 this.menu.parentType = this.xtype;
112 this.menu.triggerEl = this.el;
113 this.menu = this.addxtype(Roo.apply({}, this.menu));
116 this.el.on('click', this.onClick, this);
119 if(this.badge !== ''){
121 this.badgeEl = this.el.select('.badge', true).first().setVisibilityMode(Roo.Element.DISPLAY);
126 onClick : function(e)
133 if(this.preventDefault){
137 this.fireEvent('click', this);
142 this.setDisabled(true);
147 this.setDisabled(false);
150 setDisabled : function(state)
152 if(this.disabled == state){
156 this.disabled = state;
159 this.el.addClass('disabled');
163 this.el.removeClass('disabled');
168 setActive : function(state)
170 if(this.active == state){
177 this.el.addClass('active');
181 this.el.removeClass('active');
186 isActive: function ()
191 setBadge : function(str)
197 this.badgeEl.dom.innerHTML = str;