I added the columnDefs array to my DataTables initialization code. The purpose is that the column with index 0 can be sorted according to the values in the hidden column with index 1.
After this, the sort order indicators of column 0 no longer work, i.e. they no longer show whether the column is currently sorted in ascending or descending order.
Code:
$('#example').DataTable({
order: [], // No ordering applied by DataTable during initialisation.
paging: false,
columnDefs: [
{ orderData: 1, targets: 0 }, // Order col 0 by col 1.
{
target: 1,
visible: false,
searchable: false
}
]
});
I suppose the indicators have to be “wired” to column with index 0. But I haven’t found how.