|
Lines 508-522
jQuery.fn.dataTable.ext.errMode = function(settings, note, message) {
Link Here
|
| 508 |
|
508 |
|
| 509 |
/** |
509 |
/** |
| 510 |
* Create a new dataTables instance that uses the Koha RESTful API's as a data source |
510 |
* Create a new dataTables instance that uses the Koha RESTful API's as a data source |
| 511 |
* @param {Object} options Please see the dataTables documentation for further details |
511 |
* @param {Object} options Please see the dataTables settings documentation for further |
| 512 |
* We extend the options set with the `criteria` key which allows |
512 |
* details |
| 513 |
* the developer to select the match type to be applied during searches |
513 |
* @param {string} [options.criteria=contains] A koha specific extension to the dataTables settings block that |
| 514 |
* Valid keys are: `contains`, `starts_with`, `ends_with` and `exact` |
514 |
* allows setting the 'comparison operator' used in searches |
| 515 |
* @param {Object} table_settings The arrayref as returned by TableSettings.GetTableSettings function available |
515 |
* Supports `contains`, `starts_with`, `ends_with` and `exact` match |
| 516 |
* from the columns_settings template toolkit include |
516 |
* @param {string} [options.columns.*.type Data type the field is stored in so we may impose some additional |
| 517 |
* @param {Boolean} add_filters Add a filters row as the top row of the table |
517 |
* manipulation to search strings. Supported types are currenlty 'date' |
| 518 |
* @param {Object} default_filters Add a set of default search filters to apply at table initialisation |
518 |
* @param {Object} table_settings The arrayref as returned by TableSettings.GetTableSettings function |
| 519 |
* @return {Object} The dataTables instance |
519 |
* available from the columns_settings template toolkit include |
|
|
520 |
* @param {Boolean} add_filters Add a filters row as the top row of the table |
| 521 |
* @param {Object} default_filters Add a set of default search filters to apply at table initialisation |
| 522 |
* @return {Object} The dataTables instance |
| 520 |
*/ |
523 |
*/ |
| 521 |
$.fn.kohaTable = function(options, table_settings, add_filters, default_filters) { |
524 |
$.fn.kohaTable = function(options, table_settings, add_filters, default_filters) { |
| 522 |
var settings = null; |
525 |
var settings = null; |
|
Lines 601-606
jQuery.fn.dataTable.ext.errMode = function(settings, note, message) {
Link Here
|
| 601 |
? value |
604 |
? value |
| 602 |
: {like: (['contains', 'ends_with'].indexOf(criteria) !== -1?'%':'') + value + (['contains', 'starts_with'].indexOf(criteria) !== -1?'%':'')}; |
605 |
: {like: (['contains', 'ends_with'].indexOf(criteria) !== -1?'%':'') + value + (['contains', 'starts_with'].indexOf(criteria) !== -1?'%':'')}; |
| 603 |
parts.push(part); |
606 |
parts.push(part); |
|
|
607 |
|
| 608 |
// Alternate manipulated query based on type |
| 609 |
let type = col.type; |
| 610 |
if ( type === 'date' ) { |
| 611 |
try { |
| 612 |
let d = $date_to_rfc3339(value); |
| 613 |
parts.push({[!attr.includes('.')?'me.'+attr:attr]:d}); |
| 614 |
} |
| 615 |
catch { |
| 616 |
// Hide the warning if the date is not correct |
| 617 |
}; |
| 618 |
} |
| 604 |
} |
619 |
} |
| 605 |
return parts; |
620 |
return parts; |
| 606 |
} |
621 |
} |
| 607 |
- |
|
|