39554575a4a643de7e5cec8e5d369a006bab26e0
[roojs1] / Roo / bootstrap / CardHeader.js
1 /*
2  * - LGPL
3  *
4  * Card header - holder for the card header elements.
5  * 
6  */
7
8 /**
9  * @class Roo.bootstrap.CardHeader
10  * @extends Roo.bootstrap.Element
11  * Bootstrap Element class
12  * @cfg {String} html contents of the element
13  * @cfg {String} tag tag of the element
14  * @cfg {String} cls class of the element
15  * @cfg {Boolean} preventDefault (true|false) default false
16  * @cfg {Boolean} clickable (true|false) default false
17  * 
18  * @constructor
19  * Create a new Element
20  * @param {Object} config The config object
21  */
22
23 Roo.bootstrap.Element = function(config){
24     Roo.bootstrap.Element.superclass.constructor.call(this, config);
25     
26     this.addEvents({
27         // raw events
28         /**
29          * @event click
30          * When a element is chick
31          * @param {Roo.bootstrap.Element} this
32          * @param {Roo.EventObject} e
33          */
34         "click" : true
35     });
36 };
37
38 Roo.extend(Roo.bootstrap.Element, Roo.bootstrap.Component,  {
39     
40     tag: 'div',
41     cls: '',
42     html: '',
43     preventDefault: false, 
44     clickable: false,
45     container_method : getCardHeader
46     
47     getAutoCreate : function(){
48         
49         var cfg = {
50             tag: this.tag,
51             // cls: this.cls, double assign in parent class Component.js :: onRender
52             html: this.html
53         };
54         
55         return cfg;
56     },
57     
58     initEvents: function() 
59     {
60         Roo.bootstrap.Element.superclass.initEvents.call(this);
61         
62         if(this.clickable){
63             this.el.on('click', this.onClick, this);
64         }
65         
66     },
67     
68     onClick : function(e)
69     {
70         if(this.preventDefault){
71             e.preventDefault();
72         }
73         
74         this.fireEvent('click', this, e);
75     },
76     
77     getValue : function()
78     {
79         return this.el.dom.innerHTML;
80     },
81     
82     setValue : function(value)
83     {
84         this.el.dom.innerHTML = value;
85     }
86    
87 });
88
89  
90
91