@@ -, +, @@ datatable) - set dateformat syspref to "dd/mm/yyyy" - Go to members/readingrec.pl for a borrower having a old issues and 20/01/2011 06/03/2011 20/03/2011 Checked Out 06/03/2011 20/01/2011 20/03/2011 Checked Out - Test also with dateformat syspref "mm/dd/yyyy" --- koha-tmpl/intranet-tmpl/prog/en/js/datatables.js | 25 +++++++++++++++++++ .../prog/en/modules/members/readingrec.tt | 26 ++++++++++++++------ 2 files changed, 44 insertions(+), 7 deletions(-) --- a/koha-tmpl/intranet-tmpl/prog/en/js/datatables.js +++ a/koha-tmpl/intranet-tmpl/prog/en/js/datatables.js @@ -414,3 +414,28 @@ $.fn.dataTableExt.oSort['num-html-desc'] = function(a,b) { y = parseFloat( y ); return ((x < y) ? 1 : ((x > y) ? -1 : 0)); }; + +/* Plugin to allow sorting on data stored in a span's title attribute + * + * Ex: [% formatted_date %] + * + * In DataTables config: + * "aoColumns": [ + * { "sType": "title-string" }, + * ] + * http://datatables.net/plug-ins/sorting#hidden_title_string + */ +jQuery.extend( jQuery.fn.dataTableExt.oSort, { + "title-string-pre": function ( a ) { + return a.match(/title="(.*?)"/)[1].toLowerCase(); + }, + + "title-string-asc": function ( a, b ) { + return ((a < b) ? -1 : ((a > b) ? 1 : 0)); + }, + + "title-string-desc": function ( a, b ) { + return ((a < b) ? 1 : ((a > b) ? -1 : 0)); + } +} ); + --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt @@ -10,7 +10,19 @@ $(document).ready(function() { $("#table_readingrec").dataTable($.extend(true, {}, dataTablesDefaults, { "sPaginationType": "four_button", - "aaSorting": [] + "aaSorting": [], + "aoColumns": [ + null, + null, + null, + null, + null, + null, + null, + null, + null, + { "sType": "title-string" } + ] })); }); }); @@ -74,12 +86,12 @@ [% issue.date_due | $KohaDates %] [% ELSE %] [% END %] - [% IF issue.returndate %] - [% issue.returndate | $KohaDates %] - [% ELSE %] - Checked Out - [% END %] - + [% IF issue.returndate %] + [% issue.returndate | $KohaDates %] + [% ELSE %] + Checked Out + [% END %] + [% END %] --