Quantcast
Channel: Free community support — DataTables forums
Viewing all articles
Browse latest Browse all 35809

How to use alphanumeric sort in datatable column?

$
0
0

I am using datatable where the first column is alphanumeric and is rendered as string. Following is the sample data rendered for the first column when using dataTable jquery plugin: ABC NJ000100 ABC NJ0003001 ABC NJ0005555 ABC NJ000776 ABC NJ0008677 ABC NJ0009001 ABC NJ0009871 ABC NJ000987

However, the expected order is as follows:

ABC NJ000100 ABC NJ000776 ABC NJ000987 ABC NJ0003001 ABC NJ0005555 ABC NJ0008677 ABC NJ0009871 ABC NJ0009001

I tried using natural plugin along with dataTable as follows, but that didn't help. $(document).ready(function() {

$('#searchResults').dataTable({ "bAutoWidth": false, "aoColumns": [ { "sWidth": "10%" }, { "sWidth": "10%" }, { "sWidth": "20%", "sType": "natural"}, { "sWidth": "20%" }, { "sWidth": "20%" }, { "sWidth": "10%" }, { "sWidth": "10%" } ], "aoColumnDefs": [ { "bSortable": false, "aTargets": [ 4 ] }, { "bSortable": false, "aTargets": [ 6 ] }
] }); });


Viewing all articles
Browse latest Browse all 35809

Trending Articles