From 56be669fe9625d68630e8d4122eb8128347b5c6c Mon Sep 17 00:00:00 2001 From: Naomi Date: Mon, 1 Oct 2018 17:55:41 +0100 Subject: [PATCH] Fixed the jQuery on the download data button The click binding was getting lost after ajax reload --- modules/opencase_reporting/js/opencase-reporting.js | 6 ++++-- .../opencase_reporting/opencase_reporting.links.menu.yml | 6 ------ 2 files changed, 4 insertions(+), 8 deletions(-) delete mode 100644 modules/opencase_reporting/opencase_reporting.links.menu.yml diff --git a/modules/opencase_reporting/js/opencase-reporting.js b/modules/opencase_reporting/js/opencase-reporting.js index c916e54..6a700df 100644 --- a/modules/opencase_reporting/js/opencase-reporting.js +++ b/modules/opencase_reporting/js/opencase-reporting.js @@ -1,3 +1,5 @@ -jQuery('#opencase_reporting_buttons #download_data').click(function() { - location.href = location.href + "&_format=csv"; +jQuery('body').on('click','#opencase_reporting_buttons #download_data',function(){ + var url = new URL(location.href); + url.searchParams.append('_format', 'csv'); + location.href = url.toString(); }); diff --git a/modules/opencase_reporting/opencase_reporting.links.menu.yml b/modules/opencase_reporting/opencase_reporting.links.menu.yml deleted file mode 100644 index 1680dde..0000000 --- a/modules/opencase_reporting/opencase_reporting.links.menu.yml +++ /dev/null @@ -1,6 +0,0 @@ -opencase_reporting.new_report: - title: 'Custom report' - description: 'Make your own report' - menu_name: opencase_reporting - url: internal:/opencase/reporting/actors?title=Custom+Report - weight: 0