Getting column's data name using column index

Getting column's data name using column index

teemomrteemomr Posts: 13Questions: 3Answers: 0
edited December 2021 in Free community support

Hi,

Is it possible to get a column's data name (i.e a columns' full description: {'title':'Position','responsivePriority': 5,'data':'position_data', 'name':'position'} where data name is 'position_data') using column's index?

I'm trying to get both the sorted column's order and its data-name, but so far I'm only able to get the index of the column.

var table = $('#table1').DataTable();
var sort_col = table.order()[0][0]; //index of sorted column
var sort_col_data = ?? //how to get this?
var sort_order = table.order()[0][1];

I know I can get the column's header name using .header() and wrap it with jquery to get the innerHTML, but I don't want to rely on it. I want to know if there is a way to get column's info/data-name using the datatables API.

Can someone please help with this?

Thank you!

Answers

Sign In or Register to comment.