How to do multi column sorting in jQuery DataTable? [duplicate]

I am using jQuery DataTables to style and give functionality to one of my tables:

enter image description here

My Goal

Order by whether or not the type of funding is active or not.. which is what it is doing currently as you can see. Now, I would like to order the Funding column alphabetically.. so my wanted outcome should be:

Funding One
Funding Two
Funding Three
Funding Four
Alpha
Beta
Charlie
Test
test2

Here is what I have so far my datatables script:

var codeFundingTable = $("#Code-Funding-Table").DataTable({
    "bPaginate": false,
    "bFilter": false,
    "aoColumnDefs": [
        { "bSortable": false, "aTargets": [2] },
        { "bSearchable": false, "aTargets": [2] }
    ],
    "columns": [
        { "orderData": [1] },
        { "orderData": [0] }
    ]
});

So I am first ordering by column 1 (Active, 0-based) then by column 0 (Funding) but it is not doing it alphabetically.

How can I make this happen?


It is a guess since we have no sample data. For example, what is the value of "active" (besides a checkbox is rendered)? But I believe you can just do

var table = $('#example').DataTable({
  order: [[1, 'asc'], [0, 'asc']]
})  
  • active column is sorted first, if values is 0 and 1 asc should be used
  • first column is secondly sorted alpha, with respect of second column order

Here is a demo -> http://jsfiddle.net/0f9Ljfjr/949/ position is sorted first, then name is sorted within each position "type".