From 4d94a5207b1dc5b13ecf9dce5df1751b930b61bf 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. --- 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 c33943df1e7..39490b796a2 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.25.1