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
15 * @cfg {Boolean} showtabs (true|false) show the tabs default true
19 * @param {Object} config The config object
23 Roo.bootstrap.dash.TabBox = function(config){
24 Roo.bootstrap.dash.TabBox.superclass.constructor.call(this, config);
29 * When a pane is added
30 * @param {Roo.bootstrap.dash.TabPane} pane
37 Roo.extend(Roo.bootstrap.dash.TabBox, Roo.bootstrap.Component, {
42 getChildContainer : function()
44 return this.el.select('.tab-content', true).first();
47 getAutoCreate : function(){
51 cls: 'pull-left header',
59 cls: 'fa ' + this.icon
66 cls: 'nav-tabs-custom',
70 cls: 'nav nav-tabs pull-right',
77 cls: 'tab-content no-padding',
85 initEvents : function()
87 //Roo.log('add add pane handler');
88 this.on('addpane', this.onAddPane, this);
91 * Updates the box title
92 * @param {String} html to set the title to.
94 setTitle : function(value)
96 this.el.select('.nav-tabs .header', true).first().dom.innerHTML = value;
98 onAddPane : function(pane)
100 //Roo.log('addpane');
102 // tabs are rendere left to right..
103 var ctr = this.el.select('.nav-tabs', true).first();
106 var existing = ctr.select('.nav-tab',true);
107 var qty = existing.getCount();;
110 var tab = ctr.createChild({
112 cls : 'nav-tab' + (qty ? '' : ' active'),
120 }, qty ? existing.first().dom : ctr.select('.header', true).first().dom );
123 tab.on('click', this.onTabClick.createDelegate(this, [pane], true));
125 pane.el.addClass('active');
130 onTabClick : function(ev,un,ob,pane)
132 //Roo.log('tab - prev default');
136 this.el.select('.nav-tabs li.nav-tab', true).removeClass('active');
137 pane.tab.addClass('active');
138 //Roo.log(pane.title);
139 this.getChildContainer().select('.tab-pane',true).removeClass('active');
140 // technically we should have a deactivate event.. but maybe add later.
141 // and it should not de-activate the selected tab...
143 pane.el.addClass('active');
144 pane.fireEvent('activate');