diff --git a/dmp-frontend/src/app/library/auto-complete/single/single-auto-complete.component.ts b/dmp-frontend/src/app/library/auto-complete/single/single-auto-complete.component.ts index 8e5bdfbda..101bfaf98 100644 --- a/dmp-frontend/src/app/library/auto-complete/single/single-auto-complete.component.ts +++ b/dmp-frontend/src/app/library/auto-complete/single/single-auto-complete.component.ts @@ -181,7 +181,10 @@ export class SingleAutoCompleteComponent extends _CustomComponentMixinBase imple } stringify(value: any): string { - return JSON.stringify(value); + if (typeof value === 'string' || value instanceof String) + return value as string; + else + return JSON.stringify(value); } isNullOrEmpty(query: string): boolean { @@ -204,7 +207,7 @@ export class SingleAutoCompleteComponent extends _CustomComponentMixinBase imple const newValue = this._valueToAssign(item); //Update selected items - this._selectedItems.set(JSON.stringify(this.configuration.uniqueAssign != null ? this.configuration.uniqueAssign(newValue) : newValue), item); + this._selectedItems.set(this.stringify(this.configuration.uniqueAssign != null ? this.configuration.uniqueAssign(newValue) : newValue), item); this._setValue(newValue); @@ -244,7 +247,7 @@ export class SingleAutoCompleteComponent extends _CustomComponentMixinBase imple public onBlur($event: MouseEvent) { if (this.value != null) { const inputLabel = this.inputValue; - const selectedLabel = this._displayFn(this._selectedItems.get(this.selectedItemKey(this.value))); + const selectedLabel = this._displayFn(this._selectedItems.get(this.configuration.uniqueAssign != null ? this.configuration.uniqueAssign(this.value) : this.value)); if (inputLabel && selectedLabel !== inputLabel) { this.inputValue = selectedLabel; } @@ -344,7 +347,7 @@ export class SingleAutoCompleteComponent extends _CustomComponentMixinBase imple } private selectedItemKey(item: any) { - return JSON.stringify( + return this.stringify( this.configuration.uniqueAssign != null ? this.configuration.uniqueAssign(item) : this.configuration.valueAssign != null ? this.configuration.valueAssign(item) : item ) diff --git a/dmp-frontend/src/app/ui/external-fetcher/external-fetcher-source.component.html b/dmp-frontend/src/app/ui/external-fetcher/external-fetcher-source.component.html index 3c130aef2..abd4117ef 100644 --- a/dmp-frontend/src/app/ui/external-fetcher/external-fetcher-source.component.html +++ b/dmp-frontend/src/app/ui/external-fetcher/external-fetcher-source.component.html @@ -311,63 +311,65 @@ - + -