From f8fb76563e6373eda1894bfc351525c6f0fc7578 Mon Sep 17 00:00:00 2001 From: argirok Date: Thu, 9 Jun 2022 17:54:05 +0300 Subject: [PATCH] Autocomplete show the id if the service doesn't return any results --- utils/staticAutoComplete/staticAutoComplete.component.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/utils/staticAutoComplete/staticAutoComplete.component.ts b/utils/staticAutoComplete/staticAutoComplete.component.ts index 0c3527ed..7857d5f5 100644 --- a/utils/staticAutoComplete/staticAutoComplete.component.ts +++ b/utils/staticAutoComplete/staticAutoComplete.component.ts @@ -107,6 +107,7 @@ export class StaticAutoCompleteComponent implements OnChanges{ this.handleError("Error getting vocabulary with id: "+this.vocabularyId+" for "+this.entityName); this.warningMessage = "An Error occurred..." this.showLoading = false; + this.afterListFetchedActions(); } } ); @@ -122,6 +123,7 @@ export class StaticAutoCompleteComponent implements OnChanges{ this.handleError("Error getting results for refine field: "+this.fieldName+" for "+this.entityName, err); this.warningMessage = "An Error occured..." this.showLoading = false; + this.afterListFetchedActions(); } ); }else{ @@ -276,7 +278,12 @@ export class StaticAutoCompleteComponent implements OnChanges{ return (str.length > size)?str.substr(0,size)+'...':str; } private getSelectedNameFromGivenId(){ - if(this.list == null ){ + if(this.list == null || this.list.length == 0 ){ + this.selected.push({label: this.selectedValue, value: this.selectedValue}); + this.showInput = false; + this.updateValueLabel.emit({ + value:this.showItem(this.selected[0]) + }); return; } this.showInput = true;