LP1929741 Combobox supports startsWith search (p2)
authorBill Erickson <berickxx@gmail.com>
Tue, 22 Jun 2021 18:46:51 +0000 (14:46 -0400)
committerBill Erickson <berickxx@gmail.com>
Tue, 29 Jun 2021 15:10:16 +0000 (11:10 -0400)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/eg2/src/app/share/combobox/combobox.component.ts

index 1d4b089..77f435d 100644 (file)
@@ -261,7 +261,11 @@ export class ComboboxComponent implements ControlValueAccessor, OnInit, AfterVie
                 const field = this.idlField;
                 const args = {};
                 const extra_args = { order_by : {} };
-                args[field] = {'ilike': `%${term}%`}; // could -or search on label
+                if (this.startsWith) {
+                    args[field] = {'ilike': `${term}%`};
+                } else {
+                    args[field] = {'ilike': `%${term}%`}; // could -or search on label
+                }
                 if (this.idlQueryAnd) {
                     Object.assign(args, this.idlQueryAnd);
                 }