Entities autocomplete: show selected value if the service doesn't return

This commit is contained in:
argirok 2022-06-09 17:58:12 +03:00
parent f8fb76563e
commit de3ae0dcf1
2 changed files with 7 additions and 1 deletions

View File

@ -5,6 +5,7 @@ import {Observable, Subject} from 'rxjs';
import {EntitiesSearchService} from './entitySearch.service';
import{EnvProperties} from '../properties/env-properties';
import {StringUtils} from "../string-utils.class";
import {AutoCompleteValue} from "../../searchPages/searchUtils/searchHelperClasses.class";
//Usage example
@ -279,6 +280,11 @@ export class EntitiesAutocompleteComponent {
err => {
//console.log("An error occured"));
this.handleError("Error getting results of type: "+this.entityType+" with id: "+this.selectedValue, err);
this.selected.push( {label:this.selectedValue, id :this.selectedValue});
this.updateValueLabel.emit({
value:this.showItem(this.selected[0])
});
this.showInput = false;
}
);
}

View File

@ -279,7 +279,7 @@ export class StaticAutoCompleteComponent implements OnChanges{
}
private getSelectedNameFromGivenId(){
if(this.list == null || this.list.length == 0 ){
this.selected.push({label: this.selectedValue, value: this.selectedValue});
this.selected.push({label: this.selectedValue, id: this.selectedValue});
this.showInput = false;
this.updateValueLabel.emit({
value:this.showItem(this.selected[0])