From 23fc3858d9a31cade61390877985ffa0491e2e96 Mon Sep 17 00:00:00 2001 From: Tim Tucker Date: Sun, 30 Sep 2012 20:05:09 -0300 Subject: [PATCH] Update media/src/ext/ext.sorting.js handle undefined values, skip toLowerCase call for empty strings --- media/src/ext/ext.sorting.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/media/src/ext/ext.sorting.js b/media/src/ext/ext.sorting.js index 7810a4d5..8c7f8763 100644 --- a/media/src/ext/ext.sorting.js +++ b/media/src/ext/ext.sorting.js @@ -1,12 +1,16 @@ - $.extend( DataTable.ext.oSort, { /* * text sorting */ "string-pre": function ( a ) { - if ( typeof a != 'string' ) { - a = (a !== null && a.toString) ? a.toString() : ''; + if ( typeof a != 'string' ) + { + if (a === null || a === undefined || !a.toString) + { + return ''; + } + a = a.toString(); } return a.toLowerCase(); },