From 2f6a223c4f844c49e914a447e9ad938e087508c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lys=C3=BD?= Date: Tue, 9 Mar 2021 13:25:33 +0100 Subject: [PATCH] Duplicate the name property as the text for Select2 search [MAILPOET-3458] --- assets/js/src/subscribers/importExport/export.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/assets/js/src/subscribers/importExport/export.ts b/assets/js/src/subscribers/importExport/export.ts index 9c78c493fb..e90be7255c 100644 --- a/assets/js/src/subscribers/importExport/export.ts +++ b/assets/js/src/subscribers/importExport/export.ts @@ -14,9 +14,11 @@ interface ExportWindow extends Window { }>; subscriberFieldsSelect2: Array<{ name: string; + text: string; // Required select2 property children: Array<{ id: string; name: string; + text: string; // Required select2 property type: string | null; custom: boolean; params: object; @@ -113,6 +115,13 @@ jQuery(document).ready(() => { window.segments.forEach((item) => { segmentsContainerElement.append(jQuery('').attr('value', item.id).text(item.name)); }); + // Select2 requires the property text, then we fill it with name + window.subscriberFieldsSelect2.forEach((group) => { + group.text = group.name; // eslint-disable-line no-param-reassign + group.children.forEach((item) => { + item.text = item.name; // eslint-disable-line no-param-reassign + }); + }); renderSegmentsAndFields(segmentsContainerElement, window.segments); renderSegmentsAndFields(subscriberFieldsContainerElement, window.subscriberFieldsSelect2);