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
21 * {Boolean} showArrow show arrow next to the text (default true)
23 * Create a new Navbar Button
24 * @param {Object} config The config object
26 Roo.bootstrap.NavSidebarItem = function(config){
27 Roo.bootstrap.NavSidebarItem.superclass.constructor.call(this, config);
32 * The raw click event for the entire grid.
33 * @param {Roo.EventObject} e
38 * Fires when the active item active state changes
39 * @param {Roo.bootstrap.NavSidebarItem} this
40 * @param {boolean} state the new state
48 Roo.extend(Roo.bootstrap.NavSidebarItem, Roo.bootstrap.NavItem, {
50 badgeWeight : 'default',
56 buttonWeight : 'default',
62 getAutoCreate : function(){
67 href : this.href || '#',
76 href : this.href || '#',
77 cls: 'btn btn-' + this.buttonWeight + ' btn-' + this.buttonSize + 'roo-button-dropdown-toggle',
94 cfg.cls += ' disabled';
97 cfg.cls += ' open x-open';
100 if (this.glyphicon || this.icon) {
101 var c = this.glyphicon ? ('glyphicon glyphicon-'+this.glyphicon) : this.icon;
102 a.cn.push({ tag : 'i', cls : c }) ;
105 if(!this.buttonView){
108 html : this.html || ''
115 if (this.badge !== '') {
116 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'});
125 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;