From ac509fba473b3a7d9640bc2bb346ab6b479288a8 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Mon, 17 Jan 2022 15:45:33 +0000 Subject: [PATCH] Bug 29896: Update datatables wrapper in the OPAC This patch updates the datatables api wrapper from 'api' to 'kohaTable' to match the function of the same intention with the name in the staff client. --- koha-tmpl/opac-tmpl/bootstrap/js/datatables.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/datatables.js b/koha-tmpl/opac-tmpl/bootstrap/js/datatables.js index 5d3a543942..6fce10c885 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/js/datatables.js +++ b/koha-tmpl/opac-tmpl/bootstrap/js/datatables.js @@ -144,7 +144,17 @@ jQuery.extend( jQuery.fn.dataTableExt.oSort, { (function($) { - $.fn.api = function(options, columns_settings, add_filters) { + /** + * Create a new dataTables instance that uses the Koha RESTful API's as a data source + * @param {Object} options Please see the dataTables documentation for further details + * We extend the options set with the `criteria` key which allows + * the developer to select the match type to be applied during searches + * Valid keys are: `contains`, `starts_with`, `ends_with` and `exact` + * @param {Object} column_settings The arrayref as returned by TableSettings.GetColums function available + * from the columns_settings template toolkit include + * @return {Object} The dataTables instance + */ + $.fn.kohaTable = function(options, columns_settings) { var settings = null; if(options) { if(!options.criteria || ['contains', 'starts_with', 'ends_with', 'exact'].indexOf(options.criteria.toLowerCase()) === -1) options.criteria = 'contains'; @@ -270,7 +280,7 @@ jQuery.extend( jQuery.fn.dataTableExt.oSort, { return newnode.text().replace( /\n/g, ' ' ).trim(); } - }; + } var export_buttons = [ { -- 2.20.1