Roo/bootstrap/Element.js
[roojs1] / Roo / bootstrap / Element.js
1 /*
2  * - LGPL
3  *
4  * element
5  * 
6  */
7
8 /**
9  * @class Roo.bootstrap.Element
10  * @extends Roo.bootstrap.Component
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  * 
16  * @constructor
17  * Create a new Element
18  * @param {Object} config The config object
19  */
20
21 Roo.bootstrap.Element = function(config){
22     Roo.bootstrap.Element.superclass.constructor.call(this, config);
23 };
24
25 Roo.extend(Roo.bootstrap.Element, Roo.bootstrap.Component,  {
26     
27     tag: 'div',
28     cls: '',
29     html: '',
30      
31     
32     getAutoCreate : function(){
33         
34         var cfg = {
35             tag: this.tag,
36             cls: this.cls,
37             html: this.html
38         }
39         
40         return cfg;
41     },
42     
43     initEvents: function() 
44     {
45         
46         Roo.bootstrap.Element.superclass.initEvents.call(this);
47         
48         this.el.on('click', this.onClick, this);
49         
50     },
51     
52     onClick : function(e)
53     {
54         if (this.disabled) {
55             return;
56         }
57         
58         if(this.preventDefault){
59             e.preventDefault();
60         }
61         
62         this.fireEvent('click', this, e);
63     },
64     
65     getValue : function()
66     {
67         return this.el.dom.innerHTML;
68     },
69     
70     setValue : function(value)
71     {
72         this.el.dom.innerHTML = value;
73     }
74    
75 });
76
77  
78
79