Is it possible for DT to default sort order to a first sortable column?

Is it possible for DT to default sort order to a first sortable column?

rgavrilovrgavrilov Posts: 13Questions: 6Answers: 0
edited October 2014 in Free community support

I've just upgraded from 1.9.4 to 1.10.2, and I noticed that I get sort order indicator (triangle icon) on the first column by default, even if first column is configured as non-sortable.

First column on my page contains buttons. Sorting by that column is meaningless.

Here is a "fiddle", note that there is "(asc)" indicator on the first column when table is initialized:
http://live.datatables.net/gowisixe/1

I would prefer DT to sort by first sortable column by default. Is it possible? Is this by design?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,381Questions: 1Answers: 10,449 Site admin
    Answer ✓

    Currently by design, although I am considering changing it.

    As the documentation for columns.orderable notes:

    Note that this option only effects the end user's ability to order a column

    i.e. it does not effect the ability to change the ordering via the API, and therefore the order option.

    Use the order option to specify a default sort.

    Allan

This discussion has been closed.