From 361fd818bd0e40654e093a200b25b604c546203e Mon Sep 17 00:00:00 2001 From: Bat-Zion Rotman Date: Thu, 21 Nov 2024 18:41:58 +0200 Subject: [PATCH] display countries dropdown in alphabetic order --- .../custom-form-example-plugin/src/widgets/CountryWidget.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/custom-form-example-plugin/src/widgets/CountryWidget.tsx b/plugins/custom-form-example-plugin/src/widgets/CountryWidget.tsx index 966e1be..98cffb5 100644 --- a/plugins/custom-form-example-plugin/src/widgets/CountryWidget.tsx +++ b/plugins/custom-form-example-plugin/src/widgets/CountryWidget.tsx @@ -20,7 +20,7 @@ const CountryWidget: Widget = ({ value, onChange } const countryOptions: Option[] = data.map((country: any) => ({ label: country.name.common, value: country.name.common, - })); + })).sort(({label: label1}, {label: label2}) => label1.localeCompare(label2)); setCountries(countryOptions); } catch (err) { // eslint-disable-next-line no-alert