7 Roo.bootstrap.dash = Roo.bootstrap.dash || {};
10 * @class Roo.bootstrap.dash.TabBox
11 * @extends Roo.bootstrap.Component
12 * Bootstrap TabBox class
13 * @cfg {String} title Title of the TabBox
14 * @cfg {String} icon Icon of the TabBox
18 * @param {Object} config The config object
22 Roo.bootstrap.dash.TabBox = function(config){
23 Roo.bootstrap.dash.TabBox.superclass.constructor.call(this, config);
28 * When a pane is added
29 * @param {Roo.bootstrap.dash.TabPane} pane
36 Roo.extend(Roo.bootstrap.dash.TabBox, Roo.bootstrap.Component, {
41 getChildContainer : function()
43 return this.el.select('.tab-content', true).first();
46 getAutoCreate : function(){
50 cls: 'pull-left header',
58 cls: 'fa ' + this.icon
65 cls: 'nav-tabs-custom',
69 cls: 'nav nav-tabs pull-right',
76 cls: 'tab-content no-padding',
84 initEvents : function()
86 Roo.log('add add pane handler');
87 this.on('addpane', this.onAddPane, this);
90 * Updates the box title
91 * @param {String} html to set the title to.
93 setTitle : function(value)
95 this.el.select('.nav-tabs .header', true).first().dom.innerHTML = value;
97 onAddPane : function(pane)
101 // tabs are rendere left to right..
102 var ctr = this.el.select('.nav-tabs', true).first();
105 var existing = ctr.select('.nav-tab',true);
106 var qty = existing.getCount();;
109 var tab = ctr.createChild({
111 cls : 'nav-tab' + (qty ? '' : ' active'),
119 }, qty ? existing.first().dom : ctr.select('.header', true).first().dom );
122 tab.on('click', this.onTabClick.createDelegate(this, [pane], true));
124 pane.el.addClass('active');
129 onTabClick : function(ev,un,ob,pane)
132 this.el.select('.nav-tabs li.nav-tab', true).removeClass('active');
133 pane.tab.addClass('active');
134 //Roo.log(pane.title);
135 this.getChildContainer().select('.tab-pane',true).removeClass('active');
136 // technically we should have a deactivate event.. but maybe add later.
137 // and it should not de-activate the selected tab...
139 pane.el.addClass('active');
140 pane.fireEvent('activate');