roojs-bootstrap.js
authorEdward <edward@roojs.com>
Wed, 16 Apr 2014 11:57:02 +0000 (19:57 +0800)
committerEdward <edward@roojs.com>
Wed, 16 Apr 2014 11:57:02 +0000 (19:57 +0800)
roojs-bootstrap-debug.js

roojs-bootstrap-debug.js
roojs-bootstrap.js

index 6fc6eda..cf41769 100644 (file)
@@ -387,7 +387,7 @@ Roo.extend(Roo.bootstrap.ButtonGroup, Roo.bootstrap.Component,  {
  * @extends Roo.bootstrap.Component
  * Bootstrap Button class
  * @cfg {String} html The button content
- * @cfg {String} weight default (or empty) | primary | success | info | warning | danger
+ * @cfg {String} weight default (or empty) | primary | success | info | warning | danger | link
  * @cfg {String} size empty | lg | sm | xs
  * @cfg {String} tag empty | a | input | submit
  * @cfg {String} href empty or href
@@ -774,6 +774,7 @@ Roo.extend(Roo.bootstrap.Container, Roo.bootstrap.Component,  {
         }
         
         if (this.sticky.length) {
+            
             var bd = Roo.get(document.body);
             if (!bd.hasClass('bootstrap-sticky')) {
                 bd.addClass('bootstrap-sticky');
@@ -1113,6 +1114,7 @@ Roo.extend(Roo.bootstrap.Menu, Roo.bootstrap.Component,  {
  * Bootstrap MenuItem class
  * @cfg {String} html the menu label
  * @cfg {String} href the link
+ * @cfg {Boolean} preventDefault (true | false) default true
  * 
  * 
  * @constructor
@@ -1123,12 +1125,22 @@ Roo.extend(Roo.bootstrap.Menu, Roo.bootstrap.Component,  {
 
 Roo.bootstrap.MenuItem = function(config){
     Roo.bootstrap.MenuItem.superclass.constructor.call(this, config);
+    this.addEvents({
+        // raw events
+        /**
+         * @event click
+         * The raw click event for the entire grid.
+         * @param {Roo.EventObject} e
+         */
+        "click" : true
+    });
 };
 
 Roo.extend(Roo.bootstrap.MenuItem, Roo.bootstrap.Component,  {
     
     href : false,
     html : false,
+    preventDefault: true,
     
     getAutoCreate : function(){
         var cfg= {
@@ -1145,6 +1157,21 @@ Roo.extend(Roo.bootstrap.MenuItem, Roo.bootstrap.Component,  {
         cfg.cn[0].href = this.href || cfg.cn[0].href ;
         cfg.cn[0].html = this.html || cfg.cn[0].html ;
         return cfg;
+    },
+    
+    initEvents: function() {
+        
+        this.el.on('click', this.onClick, this);
+        
+    },
+    onClick : function(e)
+    {
+        Roo.log('item on click ');
+        if(this.preventDefault){
+            e.preventDefault();
+        }
+        
+        this.fireEvent('click', this, e);
     }
    
 });
index 8010009..ab0609a 100644 (file)
@@ -31,7 +31,8 @@ Roo.bootstrap.Header=function(A){Roo.bootstrap.Header.superclass.constructor.cal
 Roo.bootstrap.Menu=function(A){Roo.bootstrap.Menu.superclass.constructor.call(this,A);};Roo.extend(Roo.bootstrap.Menu,Roo.bootstrap.Component,{triggerEl:false,type:false,getChildContainer:function(){return this.el;},getAutoCreate:function(){var A={tag:'ul',cls:'dropdown-menu'};if(this.type==='submenu'){A.cls='submenu active'}return A;},initEvents:function(){this.triggerEl.on('click',this.toggle,this);this.triggerEl.addClass('dropdown-toggle');},toggle:function(e){if(Roo.get(e.getTarget()).findParent('.dropdown-menu')){return;}var A=this.triggerEl.hasClass('open');this.clearMenus(e);this.triggerEl[A?'removeClass':'addClass']('open');this.triggerEl.focus();e.preventDefault();},clearMenus:function(){Roo.select('.dropdown-toggle',true).each(function(aa){if(!aa.hasClass('open')){return;}
 aa.removeClass('open');})}});
 //Roo/bootstrap/MenuItem.js
-Roo.bootstrap.MenuItem=function(A){Roo.bootstrap.MenuItem.superclass.constructor.call(this,A);};Roo.extend(Roo.bootstrap.MenuItem,Roo.bootstrap.Component,{href:false,html:false,getAutoCreate:function(){var A={tag:'li',cn:[{tag:'a',href:'#',html:'Link'}]};A.cn[0].href=this.href||A.cn[0].href;A.cn[0].html=this.html||A.cn[0].html;return A;}});
+Roo.bootstrap.MenuItem=function(A){Roo.bootstrap.MenuItem.superclass.constructor.call(this,A);this.addEvents({"click":true});};Roo.extend(Roo.bootstrap.MenuItem,Roo.bootstrap.Component,{href:false,html:false,preventDefault:true,getAutoCreate:function(){var A={tag:'li',cn:[{tag:'a',href:'#',html:'Link'}]};A.cn[0].href=this.href||A.cn[0].href;A.cn[0].html=this.html||A.cn[0].html;return A;},initEvents:function(){this.el.on('click',this.onClick,this);},onClick:function(e){Roo.log('item on click ');if(this.preventDefault){e.preventDefault();}
+this.fireEvent('click',this,e);}});
 //Roo/bootstrap/MenuSeparator.js
 Roo.bootstrap.MenuSeparator=function(A){Roo.bootstrap.MenuSeparator.superclass.constructor.call(this,A);};Roo.extend(Roo.bootstrap.MenuSeparator,Roo.bootstrap.Component,{getAutoCreate:function(){var A={cls:'divider',tag:'li'};return A;}});
 //Roo/bootstrap/Modal.js