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
35 * When a pane is activated
36 * @param {Roo.bootstrap.dash.TabPane} pane
46 Roo.extend(Roo.bootstrap.dash.TabBox, Roo.bootstrap.Component, {
52 getChildContainer : function()
54 return this.el.select('.tab-content', true).first();
57 getAutoCreate : function(){
61 cls: 'pull-left header',
69 cls: 'fa ' + this.icon
76 cls: 'nav-tabs-custom',
80 cls: 'nav nav-tabs pull-right',
87 cls: 'tab-content no-padding',
95 initEvents : function()
97 //Roo.log('add add pane handler');
98 this.on('addpane', this.onAddPane, this);
101 * Updates the box title
102 * @param {String} html to set the title to.
104 setTitle : function(value)
106 this.el.select('.nav-tabs .header', true).first().dom.innerHTML = value;
108 onAddPane : function(pane)
110 //Roo.log('addpane');
112 // tabs are rendere left to right..
117 var ctr = this.el.select('.nav-tabs', true).first();
120 var existing = ctr.select('.nav-tab',true);
121 var qty = existing.getCount();;
124 var tab = ctr.createChild({
126 cls : 'nav-tab' + (qty ? '' : ' active'),
134 }, qty ? existing.first().dom : ctr.select('.header', true).first().dom );
137 tab.on('click', this.onTabClick.createDelegate(this, [pane], true));
139 pane.el.addClass('active');
144 onTabClick : function(ev,un,ob,pane)
146 //Roo.log('tab - prev default');
150 this.el.select('.nav-tabs li.nav-tab', true).removeClass('active');
151 pane.tab.addClass('active');
152 //Roo.log(pane.title);
153 this.getChildContainer().select('.tab-pane',true).removeClass('active');
154 // technically we should have a deactivate event.. but maybe add later.
155 // and it should not de-activate the selected tab...
156 this.fireEvent('activatepane', pane);
157 pane.el.addClass('active');
158 pane.fireEvent('activate');