Hi,
1. Yeah, that’s because everythings is sorted as strings. Here’s another try:
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
"numeric-empty-bottom-asc": function ( x, y ) {
if ( "" == x ) return 1;
if ( "" == y ) return -1;
return parseFloat( x ) - parseFloat( y );
},
"numeric-empty-bottom-desc": function ( y, x ) {
if ( "" == x ) return 1;
if ( "" == y ) return -1;
return parseFloat( x ) - parseFloat( y );
}
} );
I also rewrote that into a better and more modern syntax, and renamed the sort type to something that makes more sense.
2. Merging these “Custom Commands” requires a little bit more:
"bSortClasses":true, "aoColumnDefs": [ { "bSortable": false, "aTargets": [ 1, 3, 5, 7, 9, 11, 13 ] }, { "asSorting": [ "asc" ], "aTargets": [ "_all" ] }, { "sType": "numeric-empty-bottom", "aTargets": [ "_all" ] } ]
Regards,
Tobias