Numeric sorting is not working on my dataset. So I made a custom sorting that converts whole string into number then sorts based on that, but for some reasons its not working. What am i missing here?
$.fn.dataTableExt.oSort["test-desc"] = function (x, y)
{
x = parseInt(x);
y = parseInt(y);
if ( x < y)
{
return 1;
}
return 0;
};
$.fn.dataTableExt.oSort["test-asc"] = function (x, y)
{
x = parseInt(x);
y = parseInt(y);
if ( x > y)
{
return 1;
}
return 0;
}
$('table').DataTable({
"pageLength": 300,
"bLengthChange": false,
"columnDefs": [
{ "type": "test", targets: 3 }
]
});
Both ascending and descending are not working properly. I have checked these functions are being called and properly converting strings to numeric instances.
