From 9944c7894df3740fc89958ccc21545e69ad73772 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 27 Apr 2022 13:52:55 +0200 Subject: [PATCH] Bug 30607: Don't overload our default initComplete We want to keep the default initComplete call to add/remove the 'disabled' class on the 'Clear filters' link. Test plan: Search for patrons, add something to the general DT search and confirm that the 'Clear filters' link can be clicked (ie. is not disabled) when the input field is not empty. Signed-off-by: David Nind --- koha-tmpl/intranet-tmpl/prog/js/datatables.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/koha-tmpl/intranet-tmpl/prog/js/datatables.js b/koha-tmpl/intranet-tmpl/prog/js/datatables.js index 7b8e024d50..e2d8547157 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/datatables.js +++ b/koha-tmpl/intranet-tmpl/prog/js/datatables.js @@ -512,6 +512,16 @@ jQuery.fn.dataTable.ext.errMode = function(settings, note, message) { if(options) { if(!options.criteria || ['contains', 'starts_with', 'ends_with', 'exact'].indexOf(options.criteria.toLowerCase()) === -1) options.criteria = 'contains'; options.criteria = options.criteria.toLowerCase(); + + // Don't redefine the default initComplete + if ( options.initComplete ) { + let our_initComplete = options.initComplete; + options.initComplete = function(settings, json){ + our_initComplete(settings, json); + dataTablesDefaults.initComplete(settings, json) + }; + } + settings = $.extend(true, {}, dataTablesDefaults, { 'deferRender': true, "paging": true, -- 2.30.2