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
16 * @cfg {Boolean} headerScrollable (true|false) header scrollable when mobile view default false
20 * @param {Object} config The config object
24 Roo.bootstrap.dash.TabBox = function(config){
25 Roo.bootstrap.dash.TabBox.superclass.constructor.call(this, config);
30 * When a pane is added
31 * @param {Roo.bootstrap.dash.TabPane} pane
36 * When a pane is activated
37 * @param {Roo.bootstrap.dash.TabPane} pane
47 Roo.extend(Roo.bootstrap.dash.TabBox, Roo.bootstrap.Component, {
53 getChildContainer : function()
55 return this.el.select('.tab-content', true).first();
58 getAutoCreate : function(){
62 cls: 'pull-left header',
70 cls: 'fa ' + this.icon
77 cls: 'nav-tabs-custom',
81 cls: 'nav nav-tabs pull-right',
88 cls: 'tab-content no-padding',
96 initEvents : function()
98 //Roo.log('add add pane handler');
99 this.on('addpane', this.onAddPane, this);
102 * Updates the box title
103 * @param {String} html to set the title to.
105 setTitle : function(value)
107 this.el.select('.nav-tabs .header', true).first().dom.innerHTML = value;
109 onAddPane : function(pane)
111 this.panes.push(pane);
112 //Roo.log('addpane');
114 // tabs are rendere left to right..
119 var ctr = this.el.select('.nav-tabs', true).first();
122 var existing = ctr.select('.nav-tab',true);
123 var qty = existing.getCount();;
126 var tab = ctr.createChild({
128 cls : 'nav-tab' + (qty ? '' : ' active'),
136 }, qty ? existing.first().dom : ctr.select('.header', true).first().dom );
139 tab.on('click', this.onTabClick.createDelegate(this, [pane], true));
141 pane.el.addClass('active');
146 onTabClick : function(ev,un,ob,pane)
148 //Roo.log('tab - prev default');
152 this.el.select('.nav-tabs li.nav-tab', true).removeClass('active');
153 pane.tab.addClass('active');
154 //Roo.log(pane.title);
155 this.getChildContainer().select('.tab-pane',true).removeClass('active');
156 // technically we should have a deactivate event.. but maybe add later.
157 // and it should not de-activate the selected tab...
158 this.fireEvent('activatepane', pane);
159 pane.el.addClass('active');
160 pane.fireEvent('activate');
165 getActivePane : function()
168 Roo.each(this.panes, function(p) {
169 if(p.el.hasClass('active')){