From eb0366dba83a214a8f5cba9368e9c31961f72287 Mon Sep 17 00:00:00 2001 From: hengsin Date: Wed, 8 Jun 2022 05:20:59 +0800 Subject: [PATCH] IDEMPIERE-5309 foreign languages, stopped to work on http://test.idempiere.org (#1358) - Fix javascript error --- .../WEB-INF/src/org/adempiere/webui/component/Combobox.java | 2 +- .../WEB-INF/src/org/adempiere/webui/component/NumberBox.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/Combobox.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/Combobox.java index a174a9eade..89fab02309 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/Combobox.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/Combobox.java @@ -193,7 +193,7 @@ public class Combobox extends org.zkoss.zul.Combobox implements IdSpace * add widget listener to auto scroll selected item to view (i.e make visible) */ public void addScrollSelectedIntoViewListener() { - String script = "(function(){let id='#'+this.uuid+'-pp .z-comboitem-selected';let selected=zk($(id));if(selected.jq.length==1)selected.scrollIntoView();})()"; + String script = "(function(me){let id='#'+me.uuid+'-pp .z-comboitem-selected';let selected=zk($(id));if(selected.jq.length==1)selected.scrollIntoView();})(this)"; setWidgetListener("onKeyUp", script); } } \ No newline at end of file diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/NumberBox.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/NumberBox.java index 4e74b50148..14eb256214 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/NumberBox.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/NumberBox.java @@ -107,7 +107,7 @@ public class NumberBox extends Div decimalBox.setWidgetOverride("doKeyPress_", funct.toString()); funct = new StringBuffer(); // debug // funct.append("console.log('keyCode='+event.keyCode);"); - funct.append("function(event) {"); + funct.append("(function(event) {"); funct.append("let key=0;"); funct.append("if (window.event)"); funct.append(" key = event.keyCode;"); @@ -121,7 +121,7 @@ public class NumberBox extends Div funct.append(" calcText.value = newValue;"); funct.append(" calcText.setSelectionRange(position+1, position+1);"); funct.append(" event.stop;"); - funct.append("}}"); + funct.append("}})(event);"); decimalBox.setWidgetListener("onKeyDown", funct.toString()); }