roojs-bootstrap.js
[roojs1] / Roo / bootstrap / Element.js
index 085b068..4a4b58e 100644 (file)
@@ -8,11 +8,16 @@
 /**
  * @class Roo.bootstrap.Element
  * @extends Roo.bootstrap.Component
- * Bootstrap Element class
+ * @children Roo.bootstrap.Component
+ * Bootstrap Element class (basically a DIV used to make random stuff )
+ * 
  * @cfg {String} html contents of the element
  * @cfg {String} tag tag of the element
  * @cfg {String} cls class of the element
  * @cfg {Boolean} preventDefault (true|false) default false
+ * @cfg {Boolean} clickable (true|false) default false
+ * @cfg {String} role default blank - set to button to force cursor pointer
  * 
  * @constructor
  * Create a new Element
@@ -30,7 +35,9 @@ Roo.bootstrap.Element = function(config){
          * @param {Roo.bootstrap.Element} this
          * @param {Roo.EventObject} e
          */
-        "click" : true
+        "click" : true 
+        
+      
     });
 };
 
@@ -40,13 +47,19 @@ Roo.extend(Roo.bootstrap.Element, Roo.bootstrap.Component,  {
     cls: '',
     html: '',
     preventDefault: false, 
+    clickable: false,
+    tapedTwice : false,
+    role : false,
     
     getAutoCreate : function(){
         
         var cfg = {
             tag: this.tag,
-            cls: this.cls,
+            // cls: this.cls, double assign in parent class Component.js :: onRender
             html: this.html
+        };
+        if (this.role !== false) {
+            cfg.role = this.role;
         }
         
         return cfg;
@@ -54,10 +67,12 @@ Roo.extend(Roo.bootstrap.Element, Roo.bootstrap.Component,  {
     
     initEvents: function() 
     {
-        
         Roo.bootstrap.Element.superclass.initEvents.call(this);
         
-        this.el.on('click', this.onClick, this);
+        if(this.clickable){
+            this.el.on('click', this.onClick, this);
+        }
+        
         
     },
     
@@ -67,9 +82,14 @@ Roo.extend(Roo.bootstrap.Element, Roo.bootstrap.Component,  {
             e.preventDefault();
         }
         
-        this.fireEvent('click', this, e);
+        this.fireEvent('click', this, e); // why was this double click before?
     },
     
+    
+    
+
+    
+    
     getValue : function()
     {
         return this.el.dom.innerHTML;