View | Details | Raw Unified | Return to bug 29302
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/js/datatables.js (-12 / +14 lines)
Lines 519-533 jQuery.fn.dataTable.ext.errMode = function(settings, note, message) { Link Here
519
519
520
    /**
520
    /**
521
    * Create a new dataTables instance that uses the Koha RESTful API's as a data source
521
    * Create a new dataTables instance that uses the Koha RESTful API's as a data source
522
    * @param  {Object}  options         Please see the dataTables documentation for further details
522
    * @param  {Object}  options                      Please see the dataTables settings documentation for further 
523
    *                                   We extend the options set with the `criteria` key which allows
523
    *                                                details
524
    *                                   the developer to select the match type to be applied during searches
524
    * @param  {string}  [options.criteria=contains]  A koha specific extension to the dataTables settings block that 
525
    *                                   Valid keys are: `contains`, `starts_with`, `ends_with` and `exact`
525
    *                                                allows setting the 'comparison operator' used in searches 
526
    * @param  {Object}  column_settings The arrayref as returned by TableSettings.GetColums function available
526
    *                                                Supports `contains`, `starts_with`, `ends_with` and `exact` match
527
    *                                   from the columns_settings template toolkit include
527
    * @param  {string}  [options.columns.*.criteria] As above, but at the column definition level
528
    * @param  {Boolean} add_filters     Add a filters row as the top row of the table
528
    * @param  {Object}  column_settings              The arrayref as returned by TableSettings.GetColums function 
529
    * @param  {Object}  default_filters Add a set of default search filters to apply at table initialisation
529
    *                                                available from the columns_settings template toolkit include
530
    * @return {Object}                  The dataTables instance
530
    * @param  {Boolean} add_filters                  Add a filters row as the top row of the table
531
    * @param  {Object}  default_filters              Add a set of default search filters to apply at table initialisation
532
    * @return {Object}                               The dataTables instance
531
    */
533
    */
532
    $.fn.kohaTable = function(options, columns_settings, add_filters, default_filters) {
534
    $.fn.kohaTable = function(options, columns_settings, add_filters, default_filters) {
533
        var settings = null;
535
        var settings = null;
Lines 590-598 jQuery.fn.dataTable.ext.errMode = function(settings, note, message) { Link Here
590
                                    for (var i=0;i<attributes.length;i++){
592
                                    for (var i=0;i<attributes.length;i++){
591
                                        var part = {};
593
                                        var part = {};
592
                                        var attr = attributes[i];
594
                                        var attr = attributes[i];
593
                                        part[!attr.includes('.')?'me.'+attr:attr] = options.criteria === 'exact'
595
                                        var criteria = col.criteria || options.criteria;
596
                                        part[!attr.includes('.')?'me.'+attr:attr] = criteria === 'exact'
594
                                            ? value
597
                                            ? value
595
                                            : {like: (['contains', 'ends_with'].indexOf(options.criteria) !== -1?'%':'') + value + (['contains', 'starts_with'].indexOf(options.criteria) !== -1?'%':'')};
598
                                            : {like: (['contains', 'ends_with'].indexOf(criteria) !== -1?'%':'') + value + (['contains', 'starts_with'].indexOf(criteria) !== -1?'%':'')};
596
                                        parts.push(part);
599
                                        parts.push(part);
597
                                    }
600
                                    }
598
                                    return parts;
601
                                    return parts;
599
- 

Return to bug 29302