From 12f968d89216b70acdcd37ca7a79b399b119c2cd Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Thu, 19 Aug 2021 11:53:14 +0800 Subject: [PATCH] fix button # triggering url change --- Roo/bootstrap/Button.js | 2 +- roojs-bootstrap-debug.js | 2 +- roojs-bootstrap.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Roo/bootstrap/Button.js b/Roo/bootstrap/Button.js index e35ceabc1f..0c8e72506d 100644 --- a/Roo/bootstrap/Button.js +++ b/Roo/bootstrap/Button.js @@ -355,7 +355,7 @@ Roo.extend(Roo.bootstrap.Button, Roo.bootstrap.Component, { } Roo.log('button on click '); - if(this.preventDefault){ + if(this.href === '' || this.preventDefault){ e.preventDefault(); } diff --git a/roojs-bootstrap-debug.js b/roojs-bootstrap-debug.js index 21ccfdf2b8..fa3311216d 100644 --- a/roojs-bootstrap-debug.js +++ b/roojs-bootstrap-debug.js @@ -1340,7 +1340,7 @@ Roo.extend(Roo.bootstrap.Button, Roo.bootstrap.Component, { } Roo.log('button on click '); - if(this.preventDefault){ + if(this.href === '' || this.preventDefault){ e.preventDefault(); } diff --git a/roojs-bootstrap.js b/roojs-bootstrap.js index 7958bcce1a..dda79bfa8f 100644 --- a/roojs-bootstrap.js +++ b/roojs-bootstrap.js @@ -64,7 +64,7 @@ A.tag='ul';this.glyphicon='caret';if(Roo.bootstrap.version==4){this.fa='caret-do }if(A.tag!=='a'&&this.href!==''){throw "Tag must be a to set href.";}else if(this.href.length>0){A.href=this.href;}if(this.removeClass){A.cls='';}if(this.target){A.target=this.target;}return A;},initEvents:function(){if(typeof(this.menu)!='undefined'){this.menu.parentType=this.xtype; this.menu.triggerEl=this.el;this.addxtype(Roo.apply({},this.menu));}if(this.el.hasClass('roo-button')){this.el.on('click',this.onClick,this);this.el.on('dblclick',this.onDblClick,this);}else{this.el.select('.roo-button').on('click',this.onClick,this);this.el.select('.roo-button').on('dblclick',this.onDblClick,this); }if(this.removeClass){this.el.on('click',this.onClick,this);}if(this.group===true){if(this.pressed===false||this.pressed===true){}else{this.pressed=false;this.setActive(this.pressed);}}this.el.enableDisplayMode();},onClick:function(e){if(this.disabled){return; -}Roo.log('button on click ');if(this.preventDefault){e.preventDefault();}if(this.group){if(this.pressed){return;}this.setActive(true);var pi=this.parent().items;for(var i=0;i