I\'m using DataTable 1.10.9 (from https://datatables.net). Columns for the datatable are defined at the initialization step in javascript and each column has a unique name, e.g.
The following should work for you as per the API document:
var tableColumns = [{
name: 'first-name'
}, {
name: 'last-name'
}, {
name: 'position'
}, {
name: 'location'
}, {
name: 'salary'
}]
var table = $('#example').DataTable({
tableColumns
});
table.columns().every(function (index) {
console.log(tableColumns[index].name);
});