Custom Sorting with JQuery datatables

2019-08-28 05:56发布

问题:

I want to sort data through Jquery datatable in particular column. Requirement is, records to be displayed with data as "NA" first and then other records to be displayed by Ascending order. For example:

Current Order: "A" "B" "NA" "D" "NA"

Result: "NA" "NA" "A" "B" "C" "D"

回答1:

The enum plugin should work:

$.fn.dataTable.enum( [ 'NA', 'A', 'B', 'C', 'D' ] );
$('#example').DataTable();

Working example here.



标签: datatables