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 * {Boolean} open is the menu open
18 * {Boolean} buttonView use button as the tigger el rather that a (default false)
19 * {String} buttonWeight (default|primary|success|info|warning|danger)the extra classes for the button
20 * {String} buttonSize (sm|md|lg)the extra classes for the button
22 * Create a new Navbar Button
23 * @param {Object} config The config object
25 Roo.bootstrap.NavSidebarItem = function(config){
26 Roo.bootstrap.NavSidebarItem.superclass.constructor.call(this, config);
31 * The raw click event for the entire grid.
32 * @param {Roo.EventObject} e
37 * Fires when the active item active state changes
38 * @param {Roo.bootstrap.NavSidebarItem} this
39 * @param {boolean} state the new state
47 Roo.extend(Roo.bootstrap.NavSidebarItem, Roo.bootstrap.NavItem, {
49 badgeWeight : 'default',
55 buttonWeight : 'default',
61 getAutoCreate : function(){
66 href : this.href || '#',
75 href : this.href || '#',
76 cls: 'btn btn-' + this.buttonWeight + ' btn-' + this.buttonSize + 'roo-button-dropdown-toggle',
93 cfg.cls += ' disabled';
96 cfg.cls += ' open x-open';
99 if (this.glyphicon || this.icon) {
100 var c = this.glyphicon ? ('glyphicon glyphicon-'+this.glyphicon) : this.icon;
101 a.cn.push({ tag : 'i', cls : c }) ;
104 if(!this.buttonView){
107 html : this.html || ''
114 if (this.badge !== '') {
115 a.cn.push({ tag: 'span', cls : 'badge pull-right badge-' + this.badgeWeight, html: this.badge });
122 a.cn.push({ tag : 'i', cls : 'glyphicon glyphicon-chevron-down pull-right'});
123 a.cls += ' dropdown-toggle treeview' ;
131 initEvents : function()
133 if (typeof (this.menu) != 'undefined') {
134 this.menu.parentType = this.xtype;
135 this.menu.triggerEl = this.el;
136 this.menu = this.addxtype(Roo.apply({}, this.menu));
139 this.el.on('click', this.onClick, this);
141 if(this.badge !== ''){
142 this.badgeEl = this.el.select('.badge', true).first().setVisibilityMode(Roo.Element.DISPLAY);
147 onClick : function(e)
154 if(this.preventDefault){
158 this.fireEvent('click', this);
163 this.setDisabled(true);
168 this.setDisabled(false);
171 setDisabled : function(state)
173 if(this.disabled == state){
177 this.disabled = state;
180 this.el.addClass('disabled');
184 this.el.removeClass('disabled');
189 setActive : function(state)
191 if(this.active == state){
198 this.el.addClass('active');
202 this.el.removeClass('active');
207 isActive: function ()
212 setBadge : function(str)
218 this.badgeEl.dom.innerHTML = str;