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. - used to match TabItem to Panel)
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 * @event beforedeactivate
36 * Fires before a tab is de-activated - can be used to do validation on a form.
37 * @param {Roo.bootstrap.TabPanel} this
38 * @return {Boolean} false if there is an error
41 'beforedeactivate': true
44 this.tabId = this.tabId || Roo.id();
48 Roo.extend(Roo.bootstrap.TabPanel, Roo.bootstrap.Component, {
55 getAutoCreate : function(){
58 // item is needed for carousel - not sure if it has any effect otherwise
68 cfg.tabId = this.tabId;
75 initEvents: function()
77 Roo.log('-------- init events on tab panel ---------');
79 var p = this.parent();
80 this.navId = this.navId || p.navId;
82 if (typeof(this.navId) != 'undefined') {
83 // not really needed.. but just in case.. parent should be a NavGroup.
84 var tg = Roo.bootstrap.TabGroup.get(this.navId);
85 Roo.log(['register', tg, this]);
92 onRender : function(ct, position)
94 // Roo.log("Call onRender: " + this.xtype);
96 Roo.bootstrap.TabPanel.superclass.onRender.call(this, ct, position);
104 setActive: function(state)
106 Roo.log("panel - set active " + this.tabId + "=" + state);
110 this.el.removeClass('active');
112 } else if (!this.el.hasClass('active')) {
113 this.el.addClass('active');
116 var tg = Roo.bootstrap.TabGroup.get(this.navId);
120 this.fireEvent('changed', this, state);