Reputation: 139
Right now I have this code
$(document).ready(function() {
$( "#tabs" ).tabs();
$('#table_id').DataTable({
"order": [],
"autowidth": false,
"bScrollCollapse": true,
"sScrollX": "100%",
"columnDefs": [
{ "orderData":[ 1 ], "targets": [ 0 ] },
]
} );
});
This makes the first column sort the second column. It works as expected, except the sorting icon shows up on the first column instead of the second.
I need the sorting icon to show up in the second column, does anybody have any idea how to do that? Thanks
Upvotes: 1
Views: 299
Reputation: 85548
"Did I not make my question clear?". Your question is very clear, the answer is still the same: You cannot have your cake and eat it. You must programmatically sort the second column if you want sorting arrows on the second column. Simply trigger a click on the second column when the mouse is hitting the first. Here is an example :
$('#example thead th:eq(0)').off().on('mousedown', function(e) {
$('#example thead th:eq(1)').trigger('click');
return false; //prevent focus rect
})
demo -> http://jsfiddle.net/8cxn4751/
Upvotes: 1