Fix: Description text for natural sorting and monthYear sorting was incorrect - 10934

pull/2/merge
Allan Jardine 12 years ago
parent 3af3ee2c1d
commit fb0586c25e

@ -1,16 +1,16 @@
/** /**
* Often a list of data which has titles in it (books, albums etc) will have * This sorting plug-in will sort, in calendar order, data which
* the word "the" at the start of some individual titles, which you don't want * is in the format "MM YY".
* 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.
* @name Month / year sorting * @name Month / year sorting
* @anchor monthYear * @anchor monthYear
* @author Michael Motek * @author Michael Motek
*/ */
jQuery.extend( jQuery.fn.dataTableExt.oSort, { jQuery.extend( jQuery.fn.dataTableExt.oSort, {
"monthYear-pre": function ( a ) { "monthYear-pre": function ( s ) {
return new Date('01 '+a); 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 ) { "monthYear-asc": function ( a, b ) {

@ -1,8 +1,10 @@
/** /**
* Often a list of data which has titles in it (books, albums etc) will have * Data can often be a complicated mix of numbers and letters (file names
* the word "the" at the start of some individual titles, which you don't want * are a common example) and sorting them in a natural manner is quite a
* to include in your sorting order. This plug-in will strip the word "the" * difficult problem. Fortunately a deal of work has already been done in
* from the start of a string and sort on what is left. * this area by other authors - the following plug-in uses the naturalSort()
* function by Jim Palmer (<a href="http://www.overset.com/2008/09/01/javascript-natural-sort-algorithm-with-unicode-support/">download it here</a>)
* to provide natural sorting in DataTables.
* @name Natural sorting * @name Natural sorting
* @anchor natrual * @anchor natrual
* @author <a href="http://www.overset.com/2008/09/01/javascript-natural-sort-algorithm/">Jim Palmer</a> * @author <a href="http://www.overset.com/2008/09/01/javascript-natural-sort-algorithm/">Jim Palmer</a>

Loading…
Cancel
Save