Roo/bootstrap/dash/TabBox.js
[roojs1] / Roo / bootstrap / dash / TabBox.js
1 /*
2  * - LGPL
3  *
4  * TabBox
5  * 
6  */
7 Roo.bootstrap.dash = Roo.bootstrap.dash || {};
8
9 /**
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  * 
16  * @constructor
17  * Create a new TabBox
18  * @param {Object} config The config object
19  */
20
21
22 Roo.bootstrap.dash.TabBox = function(config){
23     Roo.bootstrap.dash.TabBox.superclass.constructor.call(this, config);
24     
25     this.addEvents({
26         // img events
27         /**
28          * @event click
29          * The img click event for the img.
30          * @param {Roo.EventObject} e
31          */
32         "click" : true
33     });
34 };
35
36 Roo.extend(Roo.bootstrap.dash.TabBox, Roo.bootstrap.Component,  {
37
38     title : '',
39     icon : false,
40     
41     getAutoCreate : function(){
42         
43         var header = {
44             tag: 'li',
45             cls: 'pull-left header',
46             html: this.title,
47             cn : []
48         };
49         
50         if(this.icon){
51             header.cn.push({
52                 tag: 'i',
53                 cls: 'fa ' + this.icon
54             });
55         }
56         
57         
58         var cfg = {
59             tag: 'div',
60             cls: 'nav-tabs-custom',
61             cn: [
62                 {
63                     tag: 'ul',
64                     cls: 'nav nav-tabs pull-right',
65                     cn: [
66                         header
67                     ]
68                 }
69             ]
70         }
71
72         return  cfg;
73     },
74     
75     initEvents: function() {
76         
77 //        var _this = this;
78 //        Roo.each(_this.el.select('li',true).elements, function(el){
79 //            Roo.log(el);
80 //            el.on('click', _this.onClick, el);
81 //        })
82     },
83     
84     onClick : function(e)
85     {
86 //        Roo.log('img onclick');
87 //
88 //        this.findParent('ul',false, true).select('li.active').removeClass('active');
89 //        this.addClass('active');
90 //        Roo.log(this);
91
92     }
93    
94 });
95
96