From 0112714691c5e4d0d3b818224bdc5c3baef4b43a Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 21 Oct 2021 18:00:57 +0100 Subject: [PATCH] Bug 29302: Allow passing of 'criteria' at the column level This patch adds the option to pass 'criteria' at the 'column' definition level which means you can set 'contains', 'starts_with', 'ends_with' and 'exact' match types for each different column. --- koha-tmpl/intranet-tmpl/prog/js/datatables.js | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/datatables.js b/koha-tmpl/intranet-tmpl/prog/js/datatables.js index bae315cf04..76018bc125 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/datatables.js +++ b/koha-tmpl/intranet-tmpl/prog/js/datatables.js @@ -519,15 +519,17 @@ jQuery.fn.dataTable.ext.errMode = function(settings, note, message) { /** * 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 - * @param {Boolean} add_filters Add a filters row as the top row of the table - * @param {Object} default_filters Add a set of default search filters to apply at table initialisation - * @return {Object} The dataTables instance + * @param {Object} options Please see the dataTables settings documentation for further + * details + * @param {string} [options.criteria=contains] A koha specific extension to the dataTables settings block that + * allows setting the 'comparison operator' used in searches + * Supports `contains`, `starts_with`, `ends_with` and `exact` match + * @param {string} [options.columns.*.criteria] As above, but at the column definition level + * @param {Object} column_settings The arrayref as returned by TableSettings.GetColums function + * available from the columns_settings template toolkit include + * @param {Boolean} add_filters Add a filters row as the top row of the table + * @param {Object} default_filters Add a set of default search filters to apply at table initialisation + * @return {Object} The dataTables instance */ $.fn.kohaTable = function(options, columns_settings, add_filters, default_filters) { var settings = null; @@ -590,9 +592,10 @@ jQuery.fn.dataTable.ext.errMode = function(settings, note, message) { for (var i=0;i