Lines 562-574
function _dt_default_ajax (params){
Link Here
|
562 |
} |
562 |
} |
563 |
|
563 |
|
564 |
let built_value; |
564 |
let built_value; |
565 |
let is_date_field; |
565 |
if ( col.type == 'date' ) { |
|
|
566 |
let rfc3339 = $date_to_rfc3339(value); |
567 |
if ( rfc3339 != 'Invalid Date' ) { |
568 |
built_value = rfc3339; |
569 |
} |
570 |
} |
566 |
|
571 |
|
567 |
if ( col.datatype !== undefined ) { |
572 |
if ( col.datatype !== undefined ) { |
568 |
if ( col.datatype == 'date' ) { |
573 |
if (col.datatype == 'related-object') { |
569 |
is_date_field = true; |
|
|
570 |
} |
571 |
else if (col.datatype == 'related-object') { |
572 |
let query_term = value; |
574 |
let query_term = value; |
573 |
|
575 |
|
574 |
if (criteria != 'exact') { |
576 |
if (criteria != 'exact') { |
Lines 582-596
function _dt_default_ajax (params){
Link Here
|
582 |
} else { |
584 |
} else { |
583 |
console.log("datatype %s not supported yet".format(col.datatype)); |
585 |
console.log("datatype %s not supported yet".format(col.datatype)); |
584 |
} |
586 |
} |
585 |
} else if (col.data && ( col.data.endsWith('_on') || col.data.endsWith('_date') ) ) { |
|
|
586 |
is_date_field = true; |
587 |
} |
588 |
|
589 |
if ( is_date_field ) { |
590 |
let rfc3339 = $date_to_rfc3339(value); |
591 |
if ( rfc3339 != 'Invalid Date' ) { |
592 |
built_value = rfc3339; |
593 |
} |
594 |
} |
587 |
} |
595 |
|
588 |
|
596 |
if (col.datatype != 'related-object') { |
589 |
if (col.datatype != 'related-object') { |
Lines 671-678
function _dt_default_ajax (params){
Link Here
|
671 |
|
664 |
|
672 |
if(query_parameters.length) { |
665 |
if(query_parameters.length) { |
673 |
query_parameters = JSON.stringify(query_parameters.length === 1?query_parameters[0]:{"-and": query_parameters}); |
666 |
query_parameters = JSON.stringify(query_parameters.length === 1?query_parameters[0]:{"-and": query_parameters}); |
674 |
dataSet.q = query_parameters; |
667 |
if(options.header_filter) { |
675 |
delete options.query_parameters; |
668 |
options.query_parameters = query_parameters; |
|
|
669 |
} else { |
670 |
dataSet.q = query_parameters; |
671 |
delete options.query_parameters; |
672 |
} |
676 |
} else { |
673 |
} else { |
677 |
delete options.query_parameters; |
674 |
delete options.query_parameters; |
678 |
} |
675 |
} |
Lines 930-944
function _dt_add_filters(table_node, table_dt, filters_options = {}) {
Link Here
|
930 |
|
927 |
|
931 |
/** |
928 |
/** |
932 |
* Create a new dataTables instance that uses the Koha RESTful API's as a data source |
929 |
* Create a new dataTables instance that uses the Koha RESTful API's as a data source |
933 |
* @param {Object} options Please see the dataTables documentation for further details |
930 |
* @param {Object} options Please see the dataTables settings documentation for further |
934 |
* We extend the options set with the `criteria` key which allows |
931 |
* details |
935 |
* the developer to select the match type to be applied during searches |
932 |
* @param {string} [options.criteria=contains] A koha specific extension to the dataTables settings block that |
936 |
* Valid keys are: `contains`, `starts_with`, `ends_with` and `exact` |
933 |
* allows setting the 'comparison operator' used in searches |
937 |
* @param {Object} table_settings The arrayref as returned by TableSettings.GetTableSettings function available |
934 |
* Supports `contains`, `starts_with`, `ends_with` and `exact` match |
938 |
* from the columns_settings template toolkit include |
935 |
* @param {string} [options.columns.*.type Data type the field is stored in so we may impose some additional |
939 |
* @param {Boolean} add_filters Add a filters row as the top row of the table |
936 |
* manipulation to search strings. Supported types are currenlty 'date' |
940 |
* @param {Object} default_filters Add a set of default search filters to apply at table initialisation |
937 |
* @param {Object} table_settings The arrayref as returned by TableSettings.GetTableSettings function |
941 |
* @return {Object} The dataTables instance |
938 |
* available from the columns_settings template toolkit include |
|
|
939 |
* @param {Boolean} add_filters Add a filters row as the top row of the table |
940 |
* @param {Object} default_filters Add a set of default search filters to apply at table initialisation |
941 |
* @return {Object} The dataTables instance |
942 |
*/ |
942 |
*/ |
943 |
$.fn.kohaTable = function(options, table_settings, add_filters, default_filters) { |
943 |
$.fn.kohaTable = function(options, table_settings, add_filters, default_filters) { |
944 |
var settings = null; |
944 |
var settings = null; |
945 |
- |
|
|