Skip to content
This repository
Browse code

Fix: When sorting numerically, '-' and '' should be treated as -Infin…

…ity rather than as 0, since negative numbers could also be used int he column and this would split the numbers.
  • Loading branch information...
commit 3ac3cedf535b5ee2fc5f6179ed50143878f6cc31 1 parent ec0556b
Allan Jardine authored October 30, 2012
4  examples/basic_init/zero_config.html
@@ -13,9 +13,7 @@
13 13
 		<script type="text/javascript" language="javascript" src="../../media/js/jquery.dataTables.js"></script>
14 14
 		<script type="text/javascript" charset="utf-8">
15 15
 			$(document).ready(function() {
16  
-				$('#example').dataTable( {
17  
-					bSort: false
18  
-				} );
  16
+				$('#example').dataTable();
19 17
 			} );
20 18
 		</script>
21 19
 	</head>
2  media/js/jquery.dataTables.js
@@ -11991,7 +11991,7 @@
11991 11991
 		 */
11992 11992
 		"numeric-pre": function ( a )
11993 11993
 		{
11994  
-			return (a=="-" || a==="") ? 0 : a*1;
  11994
+			return (a=="-" || a==="") ? -Infinity : a*1;
11995 11995
 		}
11996 11996
 	} );
11997 11997
 	
2  media/src/ext/ext.sorting.js
@@ -56,6 +56,6 @@ $.extend( DataTable.ext.oSort, {
56 56
 	 */
57 57
 	"numeric-pre": function ( a )
58 58
 	{
59  
-		return (a=="-" || a==="") ? 0 : a*1;
  59
+		return (a=="-" || a==="") ? -Infinity : a*1;
60 60
 	}
61 61
 } );

0 notes on commit 3ac3ced

Please sign in to comment.
Something went wrong with that request. Please try again.