From 0365e8669303fa95009c3e01418ca3edf6b6563f Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Tue, 30 Mar 2021 12:23:12 +0000 Subject: [PATCH] Bug 28055: Convert DataTables option names to current version This patch makes changes the two global DataTables files in the staff interface, replacing older 1.9.x option names with the current 1.10.x version. To test, apply the patch and confirm that default DataTables behaviors continue to work correctly: Table information, "Show XX entries" controls, pagination, search. - Test tables which use the default DataTables configuration from datatables.js: - Administration -> Z39.50/SRU servers - Administration -> MARC frameworks -> MARC structure - Test tables which use the DataTables configuration in columns_settings.inc, including column visibility and export controls. - Administration -> Libraries - Patrons -> Patron search results - Circulation -> Holds queue Signed-off-by: David Nind Signed-off-by: Katrin Fischer --- .../prog/en/includes/columns_settings.inc | 12 ++++---- koha-tmpl/intranet-tmpl/prog/js/datatables.js | 34 +++++++++++----------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/columns_settings.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/columns_settings.inc index 9a5eb315f5..7f3c214ddc 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/columns_settings.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/columns_settings.inc @@ -130,13 +130,13 @@ function KohaTable(id_selector, dt_parameters, columns_settings, add_filters) { var new_parameters = {} $.extend(true, new_parameters, dataTablesDefaults, dt_parameters); var default_column_defs = [ - { "aTargets": [ "title-string" ], "sType": "title-string" }, - { "aTargets": [ "string-sort" ], "sType": "string" }, - { "aTargets": [ "anti-the" ], "sType": "anti-the" }, - { "aTargets": [ "NoSort" ], "bSortable": false, "bSearchable": false }, + { "targets": [ "title-string" ], "type": "title-string" }, + { "targets": [ "string-sort" ], "type": "string" }, + { "targets": [ "anti-the" ], "type": "anti-the" }, + { "targets": [ "NoSort" ], "orderable": false, "searchable": false }, ]; - if ( new_parameters["aoColumnDefs"] === undefined ) { - new_parameters["aoColumnDefs"] = default_column_defs; + if ( new_parameters["columnDefs"] === undefined ) { + new_parameters["columnDefs"] = default_column_defs; } else { $.extend(true, new_parameters, default_column_defs); } diff --git a/koha-tmpl/intranet-tmpl/prog/js/datatables.js b/koha-tmpl/intranet-tmpl/prog/js/datatables.js index d47081cd5c..bdf4dcd067 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/datatables.js +++ b/koha-tmpl/intranet-tmpl/prog/js/datatables.js @@ -5,22 +5,22 @@ // // other settings // } ) ); var dataTablesDefaults = { - "oLanguage": { - "oPaginate": { - "sFirst" : __('First'), - "sLast" : __('Last'), - "sNext" : __('Next'), - "sPrevious" : __('Previous'), + "language": { + "paginate": { + "first" : __('First'), + "last" : __('Last'), + "next" : __('Next'), + "previous" : __('Previous'), }, - "sEmptyTable" : __('No data available in table'), - "sInfo" : __('Showing _START_ to _END_ of _TOTAL_ entries'), - "sInfoEmpty" : __('No entries to show'), - "sInfoFiltered" : __('(filtered from _MAX_ total entries)'), - "sLengthMenu" : __('Show _MENU_ entries'), - "sLoadingRecords" : __('Loading...'), - "sProcessing" : __('Processing...'), - "sSearch" : __('Search:'), - "sZeroRecords" : __('No matching records found'), + "emptyTable" : __('No data available in table'), + "info" : __('Showing _START_ to _END_ of _TOTAL_ entries'), + "infoEmpty" : __('No entries to show'), + "infoFiltered" : __('(filtered from _MAX_ total entries)'), + "lengthMenu" : __('Show _MENU_ entries'), + "loadingRecords" : __('Loading...'), + "processing" : __('Processing...'), + "search" : __('Search:'), + "zeroRecords" : __('No matching records found'), buttons: { "copyTitle" : __('Copy to clipboard'), "copyKeys" : __('Press ctrl or + C to copy the table data
to your system clipboard.

To cancel, click this message or press escape.'), @@ -48,8 +48,8 @@ var dataTablesDefaults = { node.addClass("disabled"); } }], - "aLengthMenu": [[10, 20, 50, 100, -1], [10, 20, 50, 100, __('All')]], - "iDisplayLength": 20, + "lengthMenu": [[10, 20, 50, 100, -1], [10, 20, 50, 100, __('All')]], + "pageLength": 20, "fixedHeader": true, initComplete: function( settings) { var tableId = settings.nTable.id -- 2.11.0