From 369010de52346b2014d6b66d848f8d5c0645d20a Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Wed, 10 Jan 2024 12:20:28 +0000 Subject: [PATCH] Bug 35329: (follow-up) Trigger Select2 upon modal open If we wait until the modal is visible Select2 can correctly calculate the width needed for the Sort 1 and Sort 2 dropdowns. --- koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc index d92c30bd02..0dad16b3ea 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc @@ -240,9 +240,12 @@ var extended_attribute_types = [% To.json(extended_attribute_types || []) | $raw %]; [% END %] - $(document).ready(function() { + $(document).on("shown.bs.modal", function(){ $('select[name="sort1_filter"]').select2({allowClear:true}); $('select[name="sort2_filter"]').select2({allowClear:true}); + }).on("hidden.bs.modal", function(){ + $('select[name="sort1_filter"]').select2("destroy"); + $('select[name="sort2_filter"]').select2("destroy"); }); -- 2.30.2