From: Bill Erickson Date: Mon, 14 Sep 2020 18:27:34 +0000 (-0400) Subject: LP1888723 Combobox avoids clearing selected for freetext X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=2c0f7a68225ad0417f6e868c57bc8797e1b12591;p=evergreen%2Fpines.git 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 --- 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) {