Getting current sorted column info
Getting current sorted column info
anjibman
Posts: 115Questions: 10Answers: 0
Hi All,
I remember once I used some API to get table's sorted column info but I couldn't find now. I want to find which column currently is used for sorted and in which order? Since I am using both legacy and new DataTable in different project in different company I will appreciate if some one can provide PAI for both version.
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Use
order()
to get the current ordering information in 1.10+. There was no public getter for the ordering information in 1.9-.Allan
Doesn't this work
var sortedCol = $('#mytable').dataTable().fnSettings().aaSorting[0][0];
var sortedDir = $('#mytable').dataTable().fnSettings().aaSorting[0][1];
It does, but it isn't a public interface and it might change in future. It isn't a supported interaction.
Allan