From 2c0f7a68225ad0417f6e868c57bc8797e1b12591 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Mon, 14 Sep 2020 14:27:34 -0400 Subject: [PATCH] LP1888723 Combobox avoids clearing selected for freetext Follow-up to LP#1850547: Avoid clearing the selected item in the combobox when selectedId is set to null in cases where freetext is enabled and a freetext value is present. Signed-off-by: Bill Erickson Signed-off-by: Ruth Frasur Signed-off-by: Galen Charlton --- Open-ILS/src/eg2/src/app/share/combobox/combobox.component.ts | 11 ++++++++++- 1 file changed, 10 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 a5ef9600e1..fb2d81bf45 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 @@ -298,7 +298,16 @@ export class ComboboxComponent implements ControlValueAccessor, OnInit, AfterVie if (!firstTime) { if ('selectedId' in changes) { if (!changes.selectedId.currentValue) { - this.selected = null; + + // In allowFreeText mode, selectedId will be null even + // though a freetext value may be present in the combobox. + if (this.allowFreeText) { + if (this.selected && !this.selected.freetext) { + this.selected = null; + } + } else { + this.selected = null; + } } } if ('idlClass' in changes) { -- 2.11.0