9 * @class Roo.bootstrap.NavGroup
10 * @extends Roo.bootstrap.Component
11 * Bootstrap NavGroup class
12 * @cfg {String} align left | right
13 * @cfg {Boolean} inverse false | true
14 * @cfg {String} type (nav|pills|tab) default nav
15 * @cfg {String} navId - reference Id for navbar.
19 * Create a new nav group
20 * @param {Object} config The config object
23 Roo.bootstrap.NavGroup = function(config){
24 Roo.bootstrap.NavGroup.superclass.constructor.call(this, config);
26 Roo.bootstrap.NavGroup.register(this);
30 * Fires when the active item changes
31 * @param {Roo.bootstrap.NavGroup} this
32 * @param {Roo.bootstrap.Navbar.Item} item The item selected
33 * @param {Roo.bootstrap.Navbar.Item} item The previously selected item
40 Roo.extend(Roo.bootstrap.NavGroup, Roo.bootstrap.Component, {
51 getAutoCreate : function()
53 var cfg = Roo.apply({}, Roo.bootstrap.NavGroup.superclass.getAutoCreate.call(this));
60 if (['tabs','pills'].indexOf(this.type)!==-1) {
61 cfg.cls += ' nav-' + this.type
63 if (this.type!=='nav') {
64 Roo.log('nav type must be nav/tabs/pills')
66 cfg.cls += ' navbar-nav'
69 if (this.parent().sidebar === true) {
78 if (this.form === true) {
84 if (this.align === 'right') {
85 cfg.cls += ' navbar-right';
87 cfg.cls += ' navbar-left';
91 if (this.align === 'right') {
92 cfg.cls += ' navbar-right';
96 cfg.cls += ' navbar-inverse';
104 setActiveItem : function(item)
107 Roo.each(this.navItems, function(v){
109 v.setActive(false, true);
116 item.el.setActive('active', true);
117 this.fireEvent('changed', this, item, prev);
123 register : function(item)
125 this.navItems.push( item);
126 item.navId = this.navId;
129 getNavItem: function(tabId)
132 Roo.each(this.navItems, function(e) {
133 if (e.tabId == tabId) {
145 Roo.apply(Roo.bootstrap.NavGroup, {
149 register : function(navgrp)
151 this.groups[navgrp.navId] = navgrp;
154 get: function(navId) {
155 return this.groups[navId];