From 59a7242231e43511c90bb129624c532ab74d688f Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 7 Mar 2023 15:02:25 +0100 Subject: [PATCH] Bug 33066: Reintroduce column filters --- koha-tmpl/intranet-tmpl/prog/js/datatables.js | 13 ++++-- .../js/vue/components/ERM/AgreementsList.vue | 41 ++++++++++--------- .../prog/js/vue/components/KohaTable.vue | 6 ++- 3 files changed, 35 insertions(+), 25 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/datatables.js b/koha-tmpl/intranet-tmpl/prog/js/datatables.js index 4a897056eb0..7caf266faed 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/datatables.js +++ b/koha-tmpl/intranet-tmpl/prog/js/datatables.js @@ -828,7 +828,7 @@ function _dt_on_visibility(add_filters, table_node, table_dt){ } } -function _dt_add_filters(table_node, table_dt) { +function _dt_add_filters(table_node, table_dt, filters_options = {}) { $(table_node).find('thead tr').clone().appendTo( $(table_node).find('thead') ); $(table_node).find('thead tr:eq(1) th').each( function (i) { @@ -837,14 +837,19 @@ function _dt_add_filters(table_node, table_dt) { $(this).data('th-id', i); if ( is_searchable ) { let input_type = 'input'; - if ( $(this).data('filter') ) { + if ( $(this).data('filter') || filters_options.hasOwnProperty(i)) { input_type = 'select' let filter_type = $(this).data('filter'); - var existing_search = table_dt.column(i).search(); + let existing_search = table_dt.column(i).search(); let select = $('