Hi,
I have a list of data that need to display inside DataTable.
When displaying the data, the sorting for that page is not working for data > 999.
My data look like this FY21_998 FY21_999 FY21_1000 FY21_1001
When sorting it will show FY21_999 as highest when i sort by descending.
My code looks like this.
var tableAdmin = db.Requesters.OrderByDescending(e => e.Requester_id).ToList();
ViewBag.AdminTable = tableAdmin;
<script type="text/javascript" class="init">
$(document).ready(function () {
$('#datatable').DataTable({
"order": [[7, "asc"], [3, "desc"]],
"lengthMenu": [[20, 40, 80, -1], [20, 40, 80, "All"]],
columnDefs: [
{ type: 'natural', targets: 0 }
]
});
$('#dataTable2').DataTable({
"order": [1, "desc"],
});
});
</script>
<table id="datatable" style="width:100%" cellspacing="0">
foreach (var item in ViewBag.AdminTable)
{
bla..bla..bla..
}
</table>