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

Update media/src/ext/ext.sorting.js

handle undefined values, skip toLowerCase call for empty strings
This commit is contained in:
Tim Tucker 2012-09-30 20:05:09 -03:00
parent 6b605936f7
commit 23fc3858d9

@ -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();
}, },