How to call a custom defined function when a column is sorted?

How to call a custom defined function when a column is sorted?

NareshNaresh Posts: 2Questions: 0Answers: 0
edited December 2011 in General
Hi,

I would like to call a function whenever the table is sorted. I tried using below code to call the function f when column 4 is sorted

oTable.fnSortListener( $('#partnerTrackerDetails div.DataTables_sort_wrapper')[4], 4, f);

However it seems like it is always sorting in descending order. I would like it to toggle between ascending and descending order and then function f is called.

I also tried to add an event when column anchor tag is clicked. However, the function f is called first and then table is getting sorted.

I am new to jquery and datatable. Please let me know what is wrong with my approach.
This discussion has been closed.