i have datatable and i want to sort in as numeric it contains value like 1st,2nd...., here is my code when i sort it it sorts values like 1st,10th,2nd so on how to sort it p
you need to define sType as numeric on the columndef where you want sorting as number
$('#example').DataTable( {
"aoColumns": [
{ "sType": "numeric" },
null,
null,
null,
null
],
// define at the place where sorting should by by numeric
// other options goes here
});
// with above the column at index 0 will be sorted by numeric and other columns are normal auto detected. the length of aoColumns should be equal to number of columns.