From 318bb230b2c856a0a441ced46f16fe56a98bf578 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 15 Nov 2023 11:44:37 +0100 Subject: [PATCH] Bug 35309: Remove DT's fnSetFilteringDelay On bug 35284 we added the delay on the column filters using dt's throttle builtin function. From doc: https://datatables.net/plug-ins/api/fnSetFilteringDelay """ Please note that this plug-in has been deprecated and the dt-init searchDelay option in DataTables 1.10 should now be used. This plug-in will not operate with v1.10+. Test plan: Note that column filtering still work as before (test on different tables, see bug 35284 for the list) Signed-off-by: Lucas Gass Signed-off-by: Marcel de Rooy Signed-off-by: Katrin Fischer (cherry picked from commit 8bb8282d6868b458237fe2b0638dc810c116077b) Signed-off-by: Fridolin Somers (cherry picked from commit 967ed52dd23bd8e4ba598ffe20a2fbdf2708aaf7) Signed-off-by: Lucas Gass --- koha-tmpl/intranet-tmpl/prog/js/datatables.js | 47 ------------------- 1 file changed, 47 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/datatables.js b/koha-tmpl/intranet-tmpl/prog/js/datatables.js index 8bd3163f68..2803452c58 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/datatables.js +++ b/koha-tmpl/intranet-tmpl/prog/js/datatables.js @@ -120,56 +120,9 @@ $.fn.dataTableExt.oApi.fnGetColumnData = function ( oSettings, iColumn, bUnique, // These keys must not launch filtering var blacklist_keys = new Array(0, 16, 17, 18, 37, 38, 39, 40); -// Set a filtering delay for global search field -jQuery.fn.dataTableExt.oApi.fnSetFilteringDelay = function ( oSettings, iDelay ) { - /* - * Inputs: object:oSettings - dataTables settings object - automatically given - * integer:iDelay - delay in milliseconds - * Usage: $('#example').dataTable().fnSetFilteringDelay(250); - * Author: Zygimantas Berziunas (www.zygimantas.com) and Allan Jardine - * License: GPL v2 or BSD 3 point style - * Contact: zygimantas.berziunas /AT\ hotmail.com - */ - var - _that = this, - iDelay = (typeof iDelay == 'undefined') ? 250 : iDelay; - - this.each( function ( i ) { - $.fn.dataTableExt.iApiIndex = i; - var - $this = this, - oTimerId = null, - sPreviousSearch = null, - anControl = $( 'input', _that.fnSettings().aanFeatures.f ); - - anControl.unbind( 'keyup.DT' ).bind( 'keyup.DT', function(event) { - var $$this = $this; - if (blacklist_keys.indexOf(event.keyCode) != -1) { - return this; - }else if ( event.keyCode == '13' ) { - $.fn.dataTableExt.iApiIndex = i; - _that.fnFilter( $(this).val() ); - } else { - if (sPreviousSearch === null || sPreviousSearch != anControl.val()) { - window.clearTimeout(oTimerId); - sPreviousSearch = anControl.val(); - oTimerId = window.setTimeout(function() { - $.fn.dataTableExt.iApiIndex = i; - _that.fnFilter( anControl.val() ); - }, iDelay); - } - } - }); - - return this; - } ); - return this; -} - // Add a filtering delay on general search and on all input (with a class 'filter') jQuery.fn.dataTableExt.oApi.fnAddFilters = function ( oSettings, sClass, iDelay ) { var table = this; - this.fnSetFilteringDelay(iDelay); var filterTimerId = null; $(table).find("input."+sClass).keyup(function(event) { if (blacklist_keys.indexOf(event.keyCode) != -1) { -- 2.39.5