diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/acqui-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/acqui-home.tt index 533cc7285e..f8f91cab66 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/acqui-home.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/acqui-home.tt @@ -270,6 +270,7 @@ "paginate": false, "autoWidth": false }, table_settings ); + let table_dt = oTable.DataTable(); $(oTable).treetable({ expandable: true @@ -286,11 +287,11 @@ $("#hide_inactive").click(function(e){ e.preventDefault(); - oTable.fnFilter( 1, 0 ); // Show only active=1 + table_dt.columns(0).search(1).draw(); // Show only active=1 }); $("#show_inactive").click(function(e){ e.preventDefault(); - oTable.fnFilter( '', 0 ); + table_dt.columns(0).search("").draw(); }); $("#hide_inactive").click(); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt index 2ed316f270..3e3979771c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt @@ -455,9 +455,9 @@ $(".show_only_subscription").click(function(){ var table_id = $(this).attr("data-tableid"); if ( $(this).prop("checked") ) { - $('#'+table_id).dataTable().fnFilter( "1", 0, true ); + $('#'+table_id).dataTable().columns(0).search(1, true).draw(); } else { - $('#'+table_id).dataTable().fnFilter( '', 0 ); + $('#'+table_id).dataTable().columns(0).search("").draw(); } }); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersuggestion.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersuggestion.tt index d53e6f2e71..198934b565 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersuggestion.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersuggestion.tt @@ -132,18 +132,19 @@ $(document).ready(function() { var suggestionst = $("#suggestionst").dataTable($.extend(true, {}, dataTablesDefaults, { "columnDefs": [ - { "targets": [ 0 ], "visible": false, "searchable": true }, // must be searchable for fnFilter + { "targets": [ 0 ], "visible": false, "searchable": true }, // must be searchable for filtering { "targets": [ -1 ], "orderable": false, "searchable": false }, ], "pagingType": "full" })); + let table_dt = suggestionst.DataTable(); $("#show_only_mine").on('click', function(e){ e.preventDefault(); - suggestionst.fnFilter('^[% logged_in_user.borrowernumber | html %]$', 0, true); + table_dt.columns(0).search('^[% logged_in_user.borrowernumber | html %]$', true).draw(); }); $("#show_all").on('click', function(e){ e.preventDefault(); - suggestionst.fnFilter('', 0 ); + table_dt.columns(0).search("").draw(); }); }); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt index 2f86e10c6d..4fb12ca869 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt @@ -732,6 +732,7 @@ "paginate": false, "autoWidth": false }); + let table_dt = oTable.DataTable(); $(oTable).treetable({ expandable: true @@ -749,11 +750,11 @@ [% UNLESS budget_period_id %] $("#hide_inactive").click(function(e){ e.preventDefault(); - oTable.fnFilter( 1, 0 ); // Show only active=1 + table_dt.columns(0).search(1).draw(); // Show only active=1 }); $("#show_inactive").click(function(e){ e.preventDefault(); - oTable.fnFilter( '', 0 ); + table_dt.columns(0).search("").draw(); // Show only active=1 }); $("#hide_inactive").click(); [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/credit_types.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/credit_types.tt index f36b8fa3ba..cccf873a6c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/credit_types.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/credit_types.tt @@ -264,11 +264,11 @@ if ($(this).hasClass('filtered')) { var filteredValue = ''; $(this).html(' '+txtActivefilter); - } else { //Not filtered. Let's do it! + } else { // Not filtered. Let's do it! var filteredValue = '0'; $(this).html(' '+txtInactivefilter); } - table_credit_types.fnFilter(filteredValue, 1, false, false); + table_credit_types.DataTable().columns(1).search(filteredValue, false, false).draw(); $(this).toggleClass('filtered'); }); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/debit_types.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/debit_types.tt index 151ef91437..e0aa3a7bd4 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/debit_types.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/debit_types.tt @@ -284,11 +284,11 @@ if ($(this).hasClass('filtered')) { var filteredValue = ''; $(this).html(' '+txtActivefilter); - } else { //Not filtered. Let's do it! + } else { // Not filtered. Let's do it! var filteredValue = '0'; $(this).html(' '+txtInactivefilter); } - table_debit_types.fnFilter(filteredValue, 1, false, false); + table_debit_types.DataTable().columns(1).search(filteredValue, false, false).draw(); $(this).toggleClass('filtered'); }); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt index 67105bfa93..771cedafa7 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt @@ -193,15 +193,16 @@ "order": [[column_sort, 'desc']] }, table_settings); + let table_dt = table.DataTable(); $("#tabs a[data-bs-toggle='tab']").on("shown.bs.tab", function (e) { active_tab = $(this).attr("href"); + let pattern = ""; if( active_tab == "#tab_checkout_panel" ){ - table.fnFilter("standard_checkout", 0); + pattern = "standard_checkout"; } else if( active_tab == "#tab_onsite_checkout_panel" ){ - table.fnFilter("onsite_checkout", 0); - } else { - table.fnFilter('', 0); + pattern = "onsite_checkout"; } + table_dt.columns(0).search(pattern).draw(); }); }); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/pay.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/pay.tt index f30834d02a..b22f7693f1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/pay.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/pay.tt @@ -418,7 +418,7 @@ e.preventDefault(); fnClickAddRow(sale_table, $( this ).data('invoiceCode'), $( this ).data('invoiceTitle'), $( this ).data('invoicePrice') ); if($('#invoices_filter').find('input[type=search]').val() !== ''){ - items_table.fnFilter( '' ); + items_table.DataTable().search('').draw(); } }); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt index ed1e0cf7de..6bf5cc03b4 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt @@ -2026,6 +2026,7 @@ }, }, table_settings); + let table_dt = rtable.DataTable(); $("#tabs a[data-bs-toggle='tab']").on("shown.bs.tab", function (e) { tabsInit( $(e.target).parent(), rtable ); @@ -2038,13 +2039,11 @@ $("#subgroup_filter").change(function() { var selected = $(this).find('option:selected'); var sg_id = $(selected).val(); + let col = table_dt.columns(5); if (sg_id.length > 0) { - const input = '^' + $.fn.dataTable.util.escapeRegex(sg_id) + '$'; - rtable.fnFilter(input, 5, true, false, true, false); - rtable.fnSetColumnVis(5, false); + col.search(sg_id, {exact:true}).visible(false).draw(); } else { - rtable.fnFilter('', 5); - rtable.fnSetColumnVis(5, true); + col.search("").visible(true).draw(); } }); @@ -2335,10 +2334,11 @@ $(this).remove(); } }); - rtable.fnFilter('', 4); - rtable.fnFilter('', 5); - rtable.fnSetColumnVis(4, true); - rtable.fnSetColumnVis(5, true); + let table_dt = rtable.DataTable(); + let col4 = table_dt.columns(4); + col4.search("").visible(true); + let col5 = table_dt.columns(4); + col5.search("").visible(true); var g_id = tab.find("a").data("tabname"); if (g_id === 'reports') { @@ -2346,9 +2346,7 @@ } if (g_id && g_id.length > 0) { - const input = '^' + $.fn.dataTable.util.escapeRegex(g_id) + '$'; - rtable.fnFilter(input, 4, true, false, true, false); - rtable.fnSetColumnVis(4, false); + col4.search(g_id, {exact:true}).visible(false); for(var i in group_subgroups[g_id]) { $("#subgroup_filter").append( '' @@ -2359,6 +2357,7 @@ } else { $("#subgroup_filter_block").hide(); } + table_dt.draw(); } function addColumn() { diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt index 7aed47a977..5c70b04238 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt @@ -486,13 +486,14 @@ [% END %] + let table_dt = table.DataTable(); $("#hide_received_orders").click(function(e){ e.preventDefault(); - table.fnFilter( '^$', 4, true ); // Not empty "Receive date" columns + table_dt.columns(4).search('^$', {regex: true}).draw(); // Not empty "Receive date" columns }); $("#show_all_orders").click(function(e){ e.preventDefault(); - table.fnFilter( '', 4 ); // Not filter, display all columns + table_dt.columns(4).search('').draw(); // Not filter, display all columns }); $("#show_all_orders").click(); diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-account.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-account.tt index 25067cac8c..f1ba5923af 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-account.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-account.tt @@ -127,14 +127,14 @@ $( document ).ready(function() { $("#filter_p").html(' '+txtActivefilter+''); $('#filter_paid').click(function(e) { e.preventDefault(); + let filteredValue = ''; if ($(this).hasClass('filtered')) { - var filteredValue = ''; $(this).html(' '+txtActivefilter); } else { //Not filtered. Let's do it! - var filteredValue = '^((?!0.00).*)$'; //Filter not matching 0.00 http://stackoverflow.com/a/406408 + filteredValue = '^((?!0.00).*)$'; //Filter not matching 0.00 http://stackoverflow.com/a/406408 $(this).html(' '+txtInactivefilter); } - fines_table.fnFilter(filteredValue, -2, true, false); + fines_table.DataTable().columns(-2).search(filteredValue, {regex: true}).draw(); $(this).toggleClass('filtered'); }); diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-readingrecord.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-readingrecord.tt index 34aebe1983..c6d445a193 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-readingrecord.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-readingrecord.tt @@ -251,16 +251,17 @@ { "orderable": false, "targets": [1]} ], }, columns_settings); + let table_dt = table.DataTable(); $("#tabs a[data-bs-toggle='tab']").on("shown.bs.tab", function (e) { var id = e.target.id; + let pattern = ""; if ( id == "checkout-tab" ) { - table.fnFilter("standard_checkout", 0); + pattern = "standard_checkout"; } else if ( id == "onsite_checkout-tab" ) { - table.fnFilter("onsite_checkout", 0); - } else { // all - table.fnFilter('', 0); + pattern = "onsite_checkout"; } + table_dt.columns(0).search(pattern).draw(); }); });
'+txtActivefilter+''); $('#filter_paid').click(function(e) { e.preventDefault(); + let filteredValue = ''; if ($(this).hasClass('filtered')) { - var filteredValue = ''; $(this).html(' '+txtActivefilter); } else { //Not filtered. Let's do it! - var filteredValue = '^((?!0.00).*)$'; //Filter not matching 0.00 http://stackoverflow.com/a/406408 + filteredValue = '^((?!0.00).*)$'; //Filter not matching 0.00 http://stackoverflow.com/a/406408 $(this).html(' '+txtInactivefilter); } - fines_table.fnFilter(filteredValue, -2, true, false); + fines_table.DataTable().columns(-2).search(filteredValue, {regex: true}).draw(); $(this).toggleClass('filtered'); }); diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-readingrecord.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-readingrecord.tt index 34aebe1983..c6d445a193 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-readingrecord.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-readingrecord.tt @@ -251,16 +251,17 @@ { "orderable": false, "targets": [1]} ], }, columns_settings); + let table_dt = table.DataTable(); $("#tabs a[data-bs-toggle='tab']").on("shown.bs.tab", function (e) { var id = e.target.id; + let pattern = ""; if ( id == "checkout-tab" ) { - table.fnFilter("standard_checkout", 0); + pattern = "standard_checkout"; } else if ( id == "onsite_checkout-tab" ) { - table.fnFilter("onsite_checkout", 0); - } else { // all - table.fnFilter('', 0); + pattern = "onsite_checkout"; } + table_dt.columns(0).search(pattern).draw(); }); });