Line 210: |
Line 210: |
| <initjs> | | <initjs> |
| | | |
− | function trim(str) {
| + | |
− | str = str.replace(/^\s+/, '');
| + | jQuery.extend( jQuery.fn.dataTableExt.oSort, { |
− | for (var i = str.length - 1; i >= 0; i--) {
| + | "date-euro-pre": function ( a ) { |
− | if (/\S/.test(str.charAt(i))) {
| + | if ($.trim(a) != '') { |
− | str = str.substring(0, i + 1);
| + | var frDate = dateStr; |
− | break;
| |
− | }
| |
− | }
| |
− | return str;
| |
− | }
| |
− |
| |
− | function dateHeight(dateStr){ | |
− | if (trim(dateStr) != '') { | |
− | var frDate = trim(dateStr); | |
| var frDateParts = frDate[0].split('/'); | | var frDateParts = frDate[0].split('/'); |
| var day = frDateParts[0] * 60 * 24; | | var day = frDateParts[0] * 60 * 24; |
Line 231: |
Line 222: |
| var minutes = 0; | | var minutes = 0; |
| var x = day+month+year+hour+minutes; | | var x = day+month+year+hour+minutes; |
− | } else {
| + | |
− | var x = 99999999999999999; //GoHorse!
| |
− | }
| |
| return x; | | return x; |
− | } | + | }, |
− |
| + | |
− | jQuery.fn.dataTableExt.oSort['date-euro-asc'] = function(a, b) {
| + | "date-euro-asc": function ( a, b ) { |
− | var x = dateHeight(a);
| + | return a > b; |
− | var y = dateHeight(b);
| + | }, |
− | var z = ((x < y) ? -1 : ((x > y) ? 1 : 0));
| + | |
− | return z;
| + | "date-euro-desc": function ( a, b ) { |
− | };
| + | return b > a; |
− |
| + | } |
− | jQuery.fn.dataTableExt.oSort['date-euro-desc'] = function(a, b) {
| + | } ); |
− | var x = dateHeight(a);
| + | |
− | var y = dateHeight(b);
| + | |
− | var z = ((x < y) ? 1 : ((x > y) ? -1 : 0));
| |
− | return z;
| |
− | };
| |
| | | |
| press_datatable = $('#press_table').dataTable({ | | press_datatable = $('#press_table').dataTable({ |