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=bc41b44266a77ee13822a01721fe607bc5b9a22b;p=working%2FEvergreen.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 --- 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 9a4aa6d084..e6acfeefd3 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 @@ -282,7 +282,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) {