N°4357 - Autocomplete issue with accent in a list

This commit is contained in:
acognet
2021-10-19 16:26:28 +02:00
parent 48b1a15bf7
commit ebe50b319a
2 changed files with 6 additions and 4 deletions

View File

@@ -226,7 +226,8 @@ class UIExtKeyWidget
while ($oObj = $oAllowedValues->Fetch()) {
$aOption = [];
$aOption['value'] = $oObj->GetKey();
$aOption['label'] = $oObj->GetName();//.'<span class=\"object-ref-icon fas fa-eye-slash object-obsolete fa-1x fa-fw\"></span>';
$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 .= "<select title=\"$sHelpText\" name=\"{$sAttrFieldPrefix}{$sFieldName}\" id=\"$this->iId\" tabindex=\"0\"></select>";
$sJsonOptions = str_replace('\\', '\\\\', json_encode($aOptions));
$sJsonOptions = str_replace("'", "\'", str_replace('\\', '\\\\', json_encode($aOptions)));
$oPage->add_ready_script(
<<<EOF
oACWidget_{$this->iId} = new ExtKeyWidget('{$this->iId}', '{$this->sTargetClass}', '$sFilter', '$sTitle', true, $sWizHelper, '{$this->sAttCode}', $sJSSearchMode, $sJSDoSearch);

View File

@@ -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);
},
});