From: Galen Charlton Date: Mon, 14 Jun 2021 22:43:12 +0000 (-0400) Subject: LP#1904244: combobox: add idlBaseQuery input X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=c081df13e591c6dacf205978b0e03f5416cd2ecc;p=Evergreen.git LP#1904244: combobox: add idlBaseQuery input This option allows to caller to tack on additional conditions to the auto-generated data source, e.g., to restrict a selector to only "active" values. Signed-off-by: Galen Charlton Signed-off-by: Ruth Frasur 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 3d3939862f..1de36525b7 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 @@ -94,6 +94,7 @@ export class ComboboxComponent implements ControlValueAccessor, OnInit, AfterVie // unless startIdFiresOnChange is set to true. @Input() startId: any = null; @Input() idlClass: string; + @Input() idlBaseQuery: any = null; @Input() startIdFiresOnChange: boolean; // Allow the selected entry ID to be passed via the template @@ -245,7 +246,10 @@ export class ComboboxComponent implements ControlValueAccessor, OnInit, AfterVie this.asyncDataSource = term => { const field = this.idlField; - const args = {}; + let args = {}; + if (this.idlBaseQuery) { + args = this.idlBaseQuery; + } const extra_args = { order_by : {} }; args[field] = {'ilike': `%${term}%`}; // could -or search on label extra_args['order_by'][this.idlClass] = field;