From fb0586c25e8e62a9031c166ad7c5366efb6d8db9 Mon Sep 17 00:00:00 2001 From: Allan Jardine Date: Thu, 19 Jul 2012 08:48:14 +0100 Subject: [PATCH] Fix: Description text for natural sorting and monthYear sorting was incorrect - 10934 --- sorting/monthYear.js | 12 ++++++------ sorting/natural.js | 10 ++++++---- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/sorting/monthYear.js b/sorting/monthYear.js index b9ed0ea..63f2e6f 100644 --- a/sorting/monthYear.js +++ b/sorting/monthYear.js @@ -1,16 +1,16 @@ /** - * Often a list of data which has titles in it (books, albums etc) will have - * the word "the" at the start of some individual titles, which you don't want - * to include in your sorting order. This plug-in will strip the word "the" - * from the start of a string and sort on what is left. + * This sorting plug-in will sort, in calendar order, data which + * is in the format "MM YY". * @name Month / year sorting * @anchor monthYear * @author Michael Motek */ jQuery.extend( jQuery.fn.dataTableExt.oSort, { - "monthYear-pre": function ( a ) { - return new Date('01 '+a); + "monthYear-pre": function ( s ) { + var a = s.split(' '); + // Date uses the American "MM DD YY" format + return new Date(a[0]+' 01 '+a[1]); }, "monthYear-asc": function ( a, b ) { diff --git a/sorting/natural.js b/sorting/natural.js index 3554fe6..44ac229 100644 --- a/sorting/natural.js +++ b/sorting/natural.js @@ -1,8 +1,10 @@ /** - * Often a list of data which has titles in it (books, albums etc) will have - * the word "the" at the start of some individual titles, which you don't want - * to include in your sorting order. This plug-in will strip the word "the" - * from the start of a string and sort on what is left. + * Data can often be a complicated mix of numbers and letters (file names + * are a common example) and sorting them in a natural manner is quite a + * difficult problem. Fortunately a deal of work has already been done in + * this area by other authors - the following plug-in uses the naturalSort() + * function by Jim Palmer (download it here) + * to provide natural sorting in DataTables. * @name Natural sorting * @anchor natrual * @author Jim Palmer