1
0
mirror of https://github.com/DataTables/DataTables.git synced 2025-03-15 16:29:16 +01:00

Merge pull request #108 from timtucker/patch-21

Fix: Update string sorting to correctly sort undefined values.
This commit is contained in:
Allan Jardine 2012-10-07 04:08:40 -07:00
commit 8b6e3fe264

View File

@ -1,12 +1,16 @@
$.extend( DataTable.ext.oSort, { $.extend( DataTable.ext.oSort, {
/* /*
* text sorting * text sorting
*/ */
"string-pre": function ( a ) "string-pre": function ( a )
{ {
if ( typeof a != 'string' ) { if ( typeof a != 'string' )
a = (a !== null && a.toString) ? a.toString() : ''; {
if (a === null || a === undefined || !a.toString)
{
return '';
}
a = a.toString();
} }
return a.toLowerCase(); return a.toLowerCase();
}, },