9 * @class Roo.bootstrap.TabPanel
10 * @extends Roo.bootstrap.Component
11 * Bootstrap TabPanel class
12 * @cfg {Boolean} active panel active
13 * @cfg {String} html panel content
14 * @cfg {String} tabId unique tab ID (will be autogenerated if not set.)
15 * @cfg {String} navId The Roo.bootstrap.NavGroup which triggers show hide ()
19 * Create a new TabPanel
20 * @param {Object} config The config object
23 Roo.bootstrap.TabPanel = function(config){
24 Roo.bootstrap.TabPanel.superclass.constructor.call(this, config);
28 * Fires when the active status changes
29 * @param {Roo.bootstrap.TabPanel} this
30 * @param {Boolean} state the new state
35 this.tabId = this.tabId || Roo.id();
36 if (typeof(p.navId) != 'undefined') {
37 // not really needed.. but just in case.. parent should be a NavGroup.
38 var tg = Roo.bootstrap.TabGroup.get(p.navId);
39 this.navId = this.navId || p.navId;
40 Roo.log(['register', tg, this]);
45 Roo.extend(Roo.bootstrap.TabPanel, Roo.bootstrap.Component, {
52 getAutoCreate : function(){
64 cfg.tabId = this.tabId;
69 onRender : function(ct, position)
71 // Roo.log("Call onRender: " + this.xtype);
73 Roo.bootstrap.TabPanel.superclass.onRender.call(this, ct, position);
75 // registration with navgroups..
76 if (this.navId && this.tabId) {
77 var grp = Roo.bootstrap.NavGroup.get(this.navId);
80 var item = grp.getNavItem(this.tabId);
82 Roo.log("could not find navID:" + this.navId + ", tabId: " + this.tabId);
84 item.on('changed', function(item, state) {
85 this.setActive(state);
91 var p = this.parent();
96 setActive: function(state)
98 Roo.log("panel - set active " + this.tabId + "=" + state);
102 this.el.removeClass('active');
104 } else if (!this.el.hasClass('active')) {
105 this.el.addClass('active');
107 this.fireEvent('changed', this, state);