From df0c7933a6d9e987170fc73f3da00840631de6c5 Mon Sep 17 00:00:00 2001 From: Mauricio Muler Bodemann Date: Mon, 11 Mar 2024 17:17:13 +0100 Subject: [PATCH] Fixes lightning button for multiple selections Fixes: OX-10886 --- .../default/taglib/t/lookupValues.html.pasta | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/main/resources/default/taglib/t/lookupValues.html.pasta b/src/main/resources/default/taglib/t/lookupValues.html.pasta index cc8325caa..8650b47dc 100644 --- a/src/main/resources/default/taglib/t/lookupValues.html.pasta +++ b/src/main/resources/default/taglib/t/lookupValues.html.pasta @@ -21,16 +21,20 @@ - const helper = document.getElementById('___id-addon'); - helper.addEventListener('click', function () { - new LookupTableInfo({ - tableName: '___table', - labelFormat: '___values.getDisplay()', - codeCallback: function (code, name) { - autocomplete.addToken({value: code, text: name}); - } + const helper = document.getElementById('___id-addon'); + helper.addEventListener('click', function () { + new LookupTableInfo({ + tableName: '___table', + labelFormat: '___values.getDisplay()', + codeCallback: function (code, name) { + if (!autocomplete.val().includes(code)) { + autocomplete.addToken({value: code, text: name}); + } else { + autocomplete.select.removeTokenWithText(name); + } + } + }); }); - });