From 54a2ea31fa99ffd3107c4ca0b27fdd54dc63cb48 Mon Sep 17 00:00:00 2001 From: joan Date: Mon, 25 Jan 2021 09:21:27 +0100 Subject: [PATCH] #2753 - Don't apply description text to autocomplete --- front/core/components/autocomplete/index.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/front/core/components/autocomplete/index.js b/front/core/components/autocomplete/index.js index a50bd8612..56b30667e 100755 --- a/front/core/components/autocomplete/index.js +++ b/front/core/components/autocomplete/index.js @@ -20,7 +20,7 @@ export default class Autocomplete extends Field { constructor($element, $, $compile, $transclude) { super($element, $, $compile); this.$transclude = $transclude; - + this.$compile = $compile; this._selection = null; this.input = this.element.querySelector('input'); } @@ -185,8 +185,14 @@ export default class Autocomplete extends Field { } else { display = this._selection[this.showField]; if (hasTemplate) { - let template = this.$transclude(() => {}, null, 'tplItem').text(); - display = this.$interpolate(template)(this._selection); + let template = this.$transclude(() => {}, null, 'tplItem'); + const element = template[0]; + const description = element.querySelector('.text-secondary'); + if (description) description.remove(); + + const displayElement = angular.element(element); + const displayText = displayElement.text(); + display = this.$interpolate(displayText)(this._selection); } } }