Getting current sorted column info

Getting current sorted column info

anjibmananjibman 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

Answers

  • allanallan Posts: 63,540Questions: 1Answers: 10,476 Site admin
    edited February 2015

    Use order() to get the current ordering information in 1.10+. There was no public getter for the ordering information in 1.9-.

    Allan

  • anjibmananjibman Posts: 115Questions: 10Answers: 0
    edited February 2015

    Doesn't this work
    var sortedCol = $('#mytable').dataTable().fnSettings().aaSorting[0][0];
    var sortedDir = $('#mytable').dataTable().fnSettings().aaSorting[0][1];

  • allanallan Posts: 63,540Questions: 1Answers: 10,476 Site admin
    Answer ✓

    It does, but it isn't a public interface and it might change in future. It isn't a supported interaction.

    Allan

This discussion has been closed.