LP1811288 Admin grids preload combobox values
[evergreen-equinox.git] / Open-ILS / src / eg2 / src / app / share / fm-editor / fm-editor.component.ts
index ec8d0b1..3e41fa2 100644 (file)
@@ -117,6 +117,10 @@ export class FmRecordEditorComponent
     // IDL record display label.  Defaults to the IDL label.
     @Input() recordLabel: string;
 
+    // When true at the component level, pre-fetch the combobox data
+    // for all combobox fields.  See also FmFieldOptions.
+    @Input() preloadLinkedValues: boolean;
+
     // Emit the modified object when the save action completes.
     @Output() onSave$ = new EventEmitter<IdlObject>();
 
@@ -368,6 +372,13 @@ export class FmRecordEditorComponent
 
         const fieldOptions = this.fieldOptions[field.name] || {};
 
+        // globally preloading unless a field-specific value is set.
+        if (this.preloadLinkedValues) {
+            if (!('preloadLinkedValues' in fieldOptions)) {
+                fieldOptions.preloadLinkedValues = true;
+            }
+        }
+
         const selector = fieldOptions.linkedSearchField ||
             this.getClassSelector(field.class);