Lines 507-512
jQuery.fn.dataTable.ext.errMode = function(settings, note, message) {
Link Here
|
507 |
function _dt_default_ajax (params){ |
507 |
function _dt_default_ajax (params){ |
508 |
let default_filters = params.default_filters; |
508 |
let default_filters = params.default_filters; |
509 |
let options = params.options; |
509 |
let options = params.options; |
|
|
510 |
let additional_data = params.additional_data; |
510 |
|
511 |
|
511 |
if(!options.criteria || ['contains', 'starts_with', 'ends_with', 'exact'].indexOf(options.criteria.toLowerCase()) === -1) options.criteria = 'contains'; |
512 |
if(!options.criteria || ['contains', 'starts_with', 'ends_with', 'exact'].indexOf(options.criteria.toLowerCase()) === -1) options.criteria = 'contains'; |
512 |
options.criteria = options.criteria.toLowerCase(); |
513 |
options.criteria = options.criteria.toLowerCase(); |
Lines 692-697
function _dt_default_ajax (params){
Link Here
|
692 |
}); |
693 |
}); |
693 |
dataSet._order_by = orderArray.filter((v, i, a) => a.indexOf(v) === i).join(','); |
694 |
dataSet._order_by = orderArray.filter((v, i, a) => a.indexOf(v) === i).join(','); |
694 |
} |
695 |
} |
|
|
696 |
dataSet = { ...dataSet, ...additional_data }; |
695 |
|
697 |
|
696 |
return dataSet; |
698 |
return dataSet; |
697 |
} |
699 |
} |
Lines 938-946
function _dt_add_filters(table_node, table_dt, filters_options = {}) {
Link Here
|
938 |
* available from the columns_settings template toolkit include |
940 |
* available from the columns_settings template toolkit include |
939 |
* @param {Boolean} add_filters Add a filters row as the top row of the table |
941 |
* @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 |
942 |
* @param {Object} default_filters Add a set of default search filters to apply at table initialisation |
|
|
943 |
* @param {Object} additional_data Add additional parameters to the ajax data |
941 |
* @return {Object} The dataTables instance |
944 |
* @return {Object} The dataTables instance |
942 |
*/ |
945 |
*/ |
943 |
$.fn.kohaTable = function(options, table_settings, add_filters, default_filters) { |
946 |
$.fn.kohaTable = function(options, table_settings, add_filters, default_filters, additional_data) { |
944 |
var settings = null; |
947 |
var settings = null; |
945 |
|
948 |
|
946 |
if(options) { |
949 |
if(options) { |
Lines 963-969
function _dt_add_filters(table_node, table_dt, filters_options = {}) {
Link Here
|
963 |
'language': { |
966 |
'language': { |
964 |
'emptyTable': (options.emptyTable) ? options.emptyTable : __("No data available in table") |
967 |
'emptyTable': (options.emptyTable) ? options.emptyTable : __("No data available in table") |
965 |
}, |
968 |
}, |
966 |
'ajax': _dt_default_ajax({default_filters, options}), |
969 |
'ajax': _dt_default_ajax({default_filters, options,additional_data}), |
967 |
}, options); |
970 |
}, options); |
968 |
} |
971 |
} |
969 |
|
972 |
|
970 |
- |
|
|