From ae16741def4de41d3afed653935b8f3cfcb53dce 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 Content-Type: text/plain; charset=utf-8 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 --- 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 564edbba4b..d7a313a9e8 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.30.2