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, {
43 getChildContainer : function()
45 return this.el.select('.tab-content', true).first();
48 getAutoCreate : function(){
52 cls: 'pull-left header',
60 cls: 'fa ' + this.icon
67 cls: 'nav-tabs-custom',
71 cls: 'nav nav-tabs pull-right',
78 cls: 'tab-content no-padding',
86 initEvents : function()
88 //Roo.log('add add pane handler');
89 this.on('addpane', this.onAddPane, this);
92 * Updates the box title
93 * @param {String} html to set the title to.
95 setTitle : function(value)
97 this.el.select('.nav-tabs .header', true).first().dom.innerHTML = value;
99 onAddPane : function(pane)
101 //Roo.log('addpane');
103 // tabs are rendere left to right..
108 var ctr = this.el.select('.nav-tabs', true).first();
111 var existing = ctr.select('.nav-tab',true);
112 var qty = existing.getCount();;
115 var tab = ctr.createChild({
117 cls : 'nav-tab' + (qty ? '' : ' active'),
125 }, qty ? existing.first().dom : ctr.select('.header', true).first().dom );
128 tab.on('click', this.onTabClick.createDelegate(this, [pane], true));
130 pane.el.addClass('active');
135 onTabClick : function(ev,un,ob,pane)
137 //Roo.log('tab - prev default');
141 this.el.select('.nav-tabs li.nav-tab', true).removeClass('active');
142 pane.tab.addClass('active');
143 //Roo.log(pane.title);
144 this.getChildContainer().select('.tab-pane',true).removeClass('active');
145 // technically we should have a deactivate event.. but maybe add later.
146 // and it should not de-activate the selected tab...
148 pane.el.addClass('active');
149 pane.fireEvent('activate');