From 0b30d74804249022a1144342614892e042fe874a Mon Sep 17 00:00:00 2001 From: Wieland Lindenthal Date: Tue, 22 Jan 2019 11:05:06 +0100 Subject: [PATCH] trigger the autocompleter on input focus when field is not empty --- .../global-search/global-search-input.component.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/frontend/src/app/components/global-search/global-search-input.component.ts b/frontend/src/app/components/global-search/global-search-input.component.ts index 623b212dd5..2e995964ff 100644 --- a/frontend/src/app/components/global-search/global-search-input.component.ts +++ b/frontend/src/app/components/global-search/global-search-input.component.ts @@ -116,7 +116,7 @@ export class GlobalSearchInputComponent implements OnDestroy { `${I18n.t('global_search.search')}: ${this.searchValue}`, this.globalSearchService.searchPath()); } - + this.cdRef.detectChanges(); }); @@ -191,6 +191,12 @@ export class GlobalSearchInputComponent implements OnDestroy { return this.renderWorkPackageItem(item.item as WorkPackageResource).appendTo(ul); } }; + + this.$input.on('focus', () => { + if (this.searchValue.length > 0) { + this.$input.autocomplete('search', this.searchValue); + } + }); } // detect if click is outside or inside the element