Is there a way to use the name, data, or column class to set the default sorting of columns? No - not at this time.
Although this thread was published in June-2015, but still I could not find such functionality in the latest version of DataTable.
Like a note! You must provide a column indexDataTable when ordering data, but you can get Column Nameone that uses ordering.
var order = table.order();
var columnIndex = order[0][0]; //column index
var orderDirection =order[0][1]; // asc or desc
//Get column header text;
var title = table.column(order[0][0]).header();
var columnName = $(title).html(); //Column Name
source
share