From ebe50b319aea934b575995367f0ae77839338321 Mon Sep 17 00:00:00 2001 From: acognet Date: Tue, 19 Oct 2021 16:26:28 +0200 Subject: [PATCH] =?UTF-8?q?N=C2=B04357=20-=20Autocomplete=20issue=20with?= =?UTF-8?q?=20accent=20in=20a=20list?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/ui.extkeywidget.class.inc.php | 5 +++-- js/extkeywidget.js | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/application/ui.extkeywidget.class.inc.php b/application/ui.extkeywidget.class.inc.php index 990ab5ecc..e743d919d 100644 --- a/application/ui.extkeywidget.class.inc.php +++ b/application/ui.extkeywidget.class.inc.php @@ -226,7 +226,8 @@ class UIExtKeyWidget while ($oObj = $oAllowedValues->Fetch()) { $aOption = []; $aOption['value'] = $oObj->GetKey(); - $aOption['label'] = $oObj->GetName();//.''; + $aOption['label'] = $oObj->GetName(); + $aOption['search_label'] = utils::HtmlEntityDecode($oObj->GetName()); if (($oAllowedValues->Count() == 1) && ($bMandatory == 'true')) { // When there is only once choice, select it by default @@ -260,7 +261,7 @@ class UIExtKeyWidget } $sInputType = CmdbAbstractObject::ENUM_INPUT_TYPE_DROPDOWN_DECORATED; $sHTMLValue .= ""; - $sJsonOptions = str_replace('\\', '\\\\', json_encode($aOptions)); + $sJsonOptions = str_replace("'", "\'", str_replace('\\', '\\\\', json_encode($aOptions))); $oPage->add_ready_script( <<iId} = new ExtKeyWidget('{$this->iId}', '{$this->sTargetClass}', '$sFilter', '$sTitle', true, $sWizHelper, '{$this->sAttCode}', $sJSSearchMode, $sJSDoSearch); diff --git a/js/extkeywidget.js b/js/extkeywidget.js index 9bd485260..dc0b46ec1 100644 --- a/js/extkeywidget.js +++ b/js/extkeywidget.js @@ -58,6 +58,7 @@ Selectize.define('custom_itop', function(aOptions) { original.apply(self); } })(); + ManageScroll = function (self) { let id = self.$input[0].id; if (self.$input.scrollParent()[0].tagName != 'HTML') { @@ -160,14 +161,14 @@ function ExtKeyWidget(id, sTargetClass, sFilter, sTitle, bSelectMode, oWizHelper }, valueField: 'value', labelField: 'label', - searchField: 'label', + searchField: 'search_label', options: JSON.parse(options), maxItems: 1, copyClassesToDropdown: false, inputClass: 'ibo-input ibo-input-select ibo-input-selectize', // To avoid dropdown to be cut by the container's overflow hidden rule dropdownParent: 'body', - onDropdownOpen: function(oDropdownElem){ + onDropdownOpen: function (oDropdownElem) { me.UpdateDropdownPosition(this.$control, oDropdownElem); }, });