Avoid initial sort when initial data matches ordering anyhow?

Avoid initial sort when initial data matches ordering anyhow?

KarloKarlo Posts: 34Questions: 10Answers: 0
edited February 2018 in Free community support

Hi!
My initial ordering is defined as order: [[0, 'desc']] and I know that the data that I provide initially comes already in that order. Therefore, can't I avoid the overhead of having DataTables perform an initial sorting? When the user clicks a sortable row later, then it should do the sorting on the client side, though.

Thanks
Karlo

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,455Questions: 1Answers: 10,465 Site admin

    You can use order: [] to stop DataTables from doing any ordering on initialisation.

    Allan

  • KarloKarlo Posts: 34Questions: 10Answers: 0
    edited February 2018

    Ok, but I'd like to see the indicator in the header to show the user that in fact the column is sorted.

  • allanallan Posts: 63,455Questions: 1Answers: 10,465 Site admin
    Answer ✓

    I'm afraid that requires DataTables to do the sort. On the plus side, if the data is already ordered, it should be darn fast.

    Allan

This discussion has been closed.