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
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 });
123 a.cn.push({ tag : 'i', cls : 'glyphicon glyphicon-chevron-down pull-right'});
124 a.cls += ' dropdown-toggle treeview' ;
132 initEvents : function()
134 if (typeof (this.menu) != 'undefined') {
135 this.menu.parentType = this.xtype;
136 this.menu.triggerEl = this.el;
137 this.menu = this.addxtype(Roo.apply({}, this.menu));
140 this.el.on('click', this.onClick, this);
142 if(this.badge !== ''){
143 this.badgeEl = this.el.select('.badge', true).first().setVisibilityMode(Roo.Element.DISPLAY);
148 onClick : function(e)
155 if(this.preventDefault){
159 this.fireEvent('click', this);
164 this.setDisabled(true);
169 this.setDisabled(false);
172 setDisabled : function(state)
174 if(this.disabled == state){
178 this.disabled = state;
181 this.el.addClass('disabled');
185 this.el.removeClass('disabled');
190 setActive : function(state)
192 if(this.active == state){
199 this.el.addClass('active');
203 this.el.removeClass('active');
208 isActive: function ()
213 setBadge : function(str)
219 this.badgeEl.dom.innerHTML = str;