Fix reference table

master
Max Ehrlicher-Schmidt 4 years ago
parent 4ef5d93c4f
commit c8742dd9ea

@ -18,7 +18,9 @@ export class AutocompleteSelectComponent implements OnInit {
@Input() @Input()
set possibleObjects(objects: any[]) { set possibleObjects(objects: any[]) {
this._possibleObjects = objects; this._possibleObjects = objects;
this.filterPossibleObjects(); setTimeout(() => {
this.filterPossibleObjects();
});
} }
get possibleObjects(): any[] { get possibleObjects(): any[] {
return this._possibleObjects; return this._possibleObjects;
@ -69,13 +71,14 @@ export class AutocompleteSelectComponent implements OnInit {
} }
onOptionSelected(element: any, trigger: MatAutocompleteTrigger) { onOptionSelected(element: any, trigger: MatAutocompleteTrigger) {
if (this.keepAutocompleteOpenAfterClick) { setTimeout(() => {
trigger.openPanel(); this.addForm.get('addGroup').reset();
} if (this.keepAutocompleteOpenAfterClick) {
this.addForm.get('addGroup').setValue(''); trigger.openPanel();
}
this.filterPossibleObjects();
});
this.selectedElementChange.emit(element); this.selectedElementChange.emit(element);
this.filterPossibleObjects();
} }
filterPossibleObjects() { filterPossibleObjects() {
@ -87,7 +90,7 @@ export class AutocompleteSelectComponent implements OnInit {
if (!searchString) { if (!searchString) {
return; return;
} }
searchString = searchString.toLocaleLowerCase(); searchString = searchString.toLocaleLowerCase().trim();
this.filteredPossibleObjects = this.filteredPossibleObjects.filter( this.filteredPossibleObjects = this.filteredPossibleObjects.filter(
(element) => (element) =>
this.nameToShowInSelection(element) this.nameToShowInSelection(element)

Loading…
Cancel
Save