From 9300b28ec0a4f63a6d0c955ba3d635f44cf17b59 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Wed, 26 Feb 2020 12:04:45 -0500 Subject: [PATCH] LP#1850547: eg-combobox: handle cases where selectedId gets cleared Sponsored-by: Evergreen Community Development Initiative Sponsored-by: Georgia Public Library Service Sponsored-by: Indiana State Library Sponsored-by: C/W MARS Signed-off-by: Galen Charlton Signed-off-by: Tiffany Little Signed-off-by: Bill Erickson --- .../src/eg2/src/app/share/combobox/combobox.component.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Open-ILS/src/eg2/src/app/share/combobox/combobox.component.ts b/Open-ILS/src/eg2/src/app/share/combobox/combobox.component.ts index 60ed2f7ad9..fb8b900176 100644 --- a/Open-ILS/src/eg2/src/app/share/combobox/combobox.component.ts +++ b/Open-ILS/src/eg2/src/app/share/combobox/combobox.component.ts @@ -274,6 +274,11 @@ export class ComboboxComponent implements ControlValueAccessor, OnInit, AfterVie } }); if (!firstTime) { + if ('selectedId' in changes) { + if (!changes.selectedId.currentValue) { + this.selected = null; + } + } if ('idlClass' in changes) { if (!('idlField' in changes)) { // let ngOnInit reset it to the @@ -283,8 +288,8 @@ export class ComboboxComponent implements ControlValueAccessor, OnInit, AfterVie this.asyncIds = {}; this.entrylist.length = 0; this.selected = null; + this.ngOnInit(); } - this.ngOnInit(); } } -- 2.43.2