From 3ac3cedf535b5ee2fc5f6179ed50143878f6cc31 Mon Sep 17 00:00:00 2001 From: Allan Jardine Date: Tue, 30 Oct 2012 21:05:15 +0000 Subject: [PATCH] Fix: When sorting numerically, '-' and '' should be treated as -Infinity rather than as 0, since negative numbers could also be used int he column and this would split the numbers. --- examples/basic_init/zero_config.html | 4 +--- media/js/jquery.dataTables.js | 2 +- media/src/ext/ext.sorting.js | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/examples/basic_init/zero_config.html b/examples/basic_init/zero_config.html index 5b110bb8..55c1d425 100644 --- a/examples/basic_init/zero_config.html +++ b/examples/basic_init/zero_config.html @@ -13,9 +13,7 @@ diff --git a/media/js/jquery.dataTables.js b/media/js/jquery.dataTables.js index 4c28d7ed..649d35e4 100644 --- a/media/js/jquery.dataTables.js +++ b/media/js/jquery.dataTables.js @@ -11991,7 +11991,7 @@ */ "numeric-pre": function ( a ) { - return (a=="-" || a==="") ? 0 : a*1; + return (a=="-" || a==="") ? -Infinity : a*1; } } ); diff --git a/media/src/ext/ext.sorting.js b/media/src/ext/ext.sorting.js index 24abd276..fc9ca1e9 100644 --- a/media/src/ext/ext.sorting.js +++ b/media/src/ext/ext.sorting.js @@ -56,6 +56,6 @@ $.extend( DataTable.ext.oSort, { */ "numeric-pre": function ( a ) { - return (a=="-" || a==="") ? 0 : a*1; + return (a=="-" || a==="") ? -Infinity : a*1; } } );