diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/dynamic-lookup-relation-modal.component.html b/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/dynamic-lookup-relation-modal.component.html
index b72a8722aec..f7f07152067 100644
--- a/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/dynamic-lookup-relation-modal.component.html
+++ b/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/dynamic-lookup-relation-modal.component.html
@@ -42,6 +42,7 @@
{{ ('submission.sections.describe.relat
[collection]="collection"
[relationship]="relationshipOptions"
[context]="context"
+ [query]="query"
[externalSource]="source"
(importedObject)="imported($event)"
class="d-block pt-3">
diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/external-source-tab/dynamic-lookup-relation-external-source-tab.component.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/external-source-tab/dynamic-lookup-relation-external-source-tab.component.ts
index 601bd8cce81..08ff5378ab8 100644
--- a/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/external-source-tab/dynamic-lookup-relation-external-source-tab.component.ts
+++ b/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/external-source-tab/dynamic-lookup-relation-external-source-tab.component.ts
@@ -75,6 +75,12 @@ export class DsDynamicLookupRelationExternalSourceTabComponent implements OnInit
* The context to displaying lists for
*/
@Input() context: Context;
+
+ /**
+ * The search query
+ */
+ @Input() query: string;
+
@Input() repeatable: boolean;
/**
* Emit an event when an object has been imported (or selected from similar local entries)
@@ -149,8 +155,12 @@ export class DsDynamicLookupRelationExternalSourceTabComponent implements OnInit
this.resetRoute();
this.entriesRD$ = this.searchConfigService.paginatedSearchOptions.pipe(
- switchMap((searchOptions: PaginatedSearchOptions) =>
- this.externalSourceService.getExternalSourceEntries(this.externalSource.id, searchOptions).pipe(startWith(undefined)))
+ switchMap((searchOptions: PaginatedSearchOptions) => {
+ if (searchOptions.query === '') {
+ searchOptions.query = this.query;
+ }
+ return this.externalSourceService.getExternalSourceEntries(this.externalSource.id, searchOptions).pipe(startWith(undefined));
+ })
);
this.currentPagination$ = this.paginationService.getCurrentPagination(this.searchConfigService.paginationID, this.initialPagination);
this.importConfig = {
diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/external-source-tab/themed-dynamic-lookup-relation-external-source-tab.component.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/external-source-tab/themed-dynamic-lookup-relation-external-source-tab.component.ts
index 637941ce5bf..113d902c3d8 100644
--- a/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/external-source-tab/themed-dynamic-lookup-relation-external-source-tab.component.ts
+++ b/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/external-source-tab/themed-dynamic-lookup-relation-external-source-tab.component.ts
@@ -15,7 +15,7 @@ import { DsDynamicLookupRelationExternalSourceTabComponent } from './dynamic-loo
})
export class ThemedDynamicLookupRelationExternalSourceTabComponent extends ThemedComponent {
protected inAndOutputNames: (keyof DsDynamicLookupRelationExternalSourceTabComponent & keyof this)[] = ['label', 'listId',
- 'item', 'collection', 'relationship', 'context', 'repeatable', 'importedObject', 'externalSource'];
+ 'item', 'collection', 'relationship', 'context', 'query', 'repeatable', 'importedObject', 'externalSource'];
@Input() label: string;
@@ -29,6 +29,8 @@ export class ThemedDynamicLookupRelationExternalSourceTabComponent extends Theme
@Input() context: Context;
+ @Input() query: string;
+
@Input() repeatable: boolean;
@Output() importedObject: EventEmitter = new EventEmitter();