LP#1916949: combobox: asyncSupportsEmptyTermClick fix
authorGalen Charlton <gmc@equinoxOLI.org>
Fri, 4 Dec 2020 16:17:51 +0000 (11:17 -0500)
committerGalen Charlton <gmc@equinoxOLI.org>
Tue, 21 Sep 2021 15:04:40 +0000 (11:04 -0400)
This is a backport of a patch that was included as part
of LP#1904244.

Fixes situation where combobox would fetch the needed entries
in async mode, but fail to open the drop-down.

This includes code originally written by Bill Erickson with
additions by Galen Charlton to insure that static data sources
would continue to work.

Signed-off-by: Galen Charlton <gmc@equinoxOLI.org>
Signed-off-by: Ruth Frasur <rfrasur@library.in.gov>
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/eg2/src/app/share/combobox/combobox.component.ts

index d21ad5f..cf9b46a 100644 (file)
@@ -457,7 +457,7 @@ export class ComboboxComponent implements ControlValueAccessor, OnInit, AfterVie
                 (entry: ComboboxEntry) => this.addAsyncEntry(entry),
                 err => {},
                 ()  => {
-                    observer.next(searchTerm);
+                    observer.next(term);
                     observer.complete();
                 }
             );
@@ -487,9 +487,13 @@ export class ComboboxComponent implements ControlValueAccessor, OnInit, AfterVie
                 // click action occurred.
                 if (term === '') { return []; }
 
-                // In sync-data mode, a click displays the full list.
-                if (term === '_CLICK_' && !this.asyncDataSource) {
-                    return this.entrylist;
+                // Clicking always displays the full list.
+                if (term === '_CLICK_') {
+                    if (this.asyncDataSource) {
+                        term = '';
+                    } else {
+                        return this.entrylist;
+                    }
                 }
 
                 // Filter entrylist whose labels substring-match the