diff --git a/employee/templates/employee_export_filter.html b/employee/templates/employee_export_filter.html index c9fa558f8..a80fbcc94 100644 --- a/employee/templates/employee_export_filter.html +++ b/employee/templates/employee_export_filter.html @@ -42,7 +42,9 @@
- {{export_filter.form.country}} + {% comment %} # 913 {% endcomment %}
diff --git a/static/build/js/htmxSelect2.js b/static/build/js/htmxSelect2.js index 2f0c2a8a7..b5bff4c99 100644 --- a/static/build/js/htmxSelect2.js +++ b/static/build/js/htmxSelect2.js @@ -3972,6 +3972,9 @@ return ( this.each(function () { var e = s.GetData(this, "select2"); + console.log(this) + console.log(e) + console.log('____________________________________________________________________________') null == e && window.console && console.error && @@ -3999,29 +4002,29 @@ }); staticUrl = $("#statiUrl").attr("data-url"); -$(document).ready(function () { - $(".oh-select").each(function () { - if ($(this).hasClass("select2-hidden-accessible")) { - $(this).select2("destroy"); +function initSelect2(context) { + $(context).find(".oh-select").each(function () { + if ($(this).data("select2")) { + $(this).select2("destroy"); // only destroy if initialized } - $(this).select2({ width: '100%' }); + $(this).select2({ width: "100%" }); }); - $("select").on("select2:select", function (e) { - $(this)[0].dispatchEvent(new Event("change")); - }); -}); - - -$(document).on("htmx:afterSettle", function (event) { - var target = $(event.target); - target.find(".oh-select").select2({ width: '100%' }); - - target.find("select").off("select2:select").on("select2:select", function (e) { + $(context).find("select").off("select2:select").on("select2:select", function () { this.dispatchEvent(new Event("change")); }); +} + + +$(document).ready(function () { + // initSelect2(document); # 914 , Loading two select fields }); +$(document).on("htmx:afterSettle", function (event) { + initSelect2(event.target); +}); + + // Helper function to hash data using SHA-256 async function hashData(data) {