'DataTable conditional columnDefs orderData

I would like to do something like :

columnDefs: [
     if(sorting direction of the target (column 0 here) is 'asc'){
         { orderData: [14,13,12,0],    targets: 0 }
     }
     else{
         { orderData: [18,13,12,0],    targets: 0 }
     }
],

In other words, the multicolumns used in the sorting (orderData) are different depending on whether it is ascending or descending.

Hope to be clear,

Thanks for your help !



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source