How can I create a separate link to sort dat in columns

How can I create a separate link to sort dat in columns

NishantNishant Posts: 2Questions: 0Answers: 0
edited April 2011 in General
$('#jobs').dataTable({'sPaginationType': 'full_numbers',
'aaData': <?php echo html_entity_decode(json_encode($pageArr)) ?>,
'iDisplayLength':5 ,
"bAutoWidth": false,

"aaSorting": [[ 0, "desc" ]],
"aoColumns": [ null,{"bVisible":false},{"bVisible":false}]
});

I am hiding second and third columns of table but want a sort against them , How can I make a separate link to sort by them ...

Replies

  • allanallan Posts: 63,517Questions: 1Answers: 10,473 Site admin
    You can use the fnSort API method: http://datatables.net/api#fnSort . Just call fnSort with the parameters for however you want to sort the table.

    Allan
  • NishantNishant Posts: 2Questions: 0Answers: 0
    Great it works fine , but now I am stuck on some other issue , I have applied a css class 'sorting_1' to td of table , but they are visible in first page only
    var oDataTable=$('#jobs').dataTable();
    oDataTable.fnSort( [[2,"desc"]]); // call the sort
    $('#jobs td').addClass('sorting_1');

    But how can I add this code for paging button, as well as select change [10/20/....]
    $('#jobs td').addClass('sorting_1
This discussion has been closed.