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',
84 cls: 'nav nav-tabs pull-right',
93 cls: 'tab-content no-padding',
101 initEvents : function()
103 //Roo.log('add add pane handler');
104 this.on('addpane', this.onAddPane, this);
107 * Updates the box title
108 * @param {String} html to set the title to.
110 setTitle : function(value)
112 this.el.select('.nav-tabs .header', true).first().dom.innerHTML = value;
114 onAddPane : function(pane)
116 this.panes.push(pane);
117 //Roo.log('addpane');
119 // tabs are rendere left to right..
124 var ctr = this.el.select('.nav-tabs', true).first();
127 var existing = ctr.select('.nav-tab',true);
128 var qty = existing.getCount();;
131 var tab = ctr.createChild({
133 cls : 'nav-tab' + (qty ? '' : ' active'),
141 }, qty ? existing.first().dom : ctr.select('.header', true).first().dom );
144 tab.on('click', this.onTabClick.createDelegate(this, [pane], true));
146 pane.el.addClass('active');
151 onTabClick : function(ev,un,ob,pane)
153 //Roo.log('tab - prev default');
157 this.el.select('.nav-tabs li.nav-tab', true).removeClass('active');
158 pane.tab.addClass('active');
159 //Roo.log(pane.title);
160 this.getChildContainer().select('.tab-pane',true).removeClass('active');
161 // technically we should have a deactivate event.. but maybe add later.
162 // and it should not de-activate the selected tab...
163 this.fireEvent('activatepane', pane);
164 pane.el.addClass('active');
165 pane.fireEvent('activate');
170 getActivePane : function()
173 Roo.each(this.panes, function(p) {
174 if(p.el.hasClass('active')){