Multiple header sort

Multiple header sort

tudortudor Posts: 1Questions: 0Answers: 0
edited August 2011 in General
Hi Allan,
I'm using datatable with some kind of "double header".

[code]


Name
Price
Start



Update
End


[/code]

All columns are sortable, but only the first row-header works like a sortheader, the second row-header looks like a header but it doesn't has the specific sort icons and doesn't perform any sort.
Q: Is is possible to make the second row-header works like a sortable one? If 'yes', how?

Hope you understand my question.

Thank you for your great plugin!!

Tudor.

Replies

  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    I doubt that DataTables will do it itself (though I may be wrong.. I think only one row in your header is active as the sort elements)

    but you can always add any click handlers to any TH cells and use the API function fnSort to sort by whichever criteria you want.

    http://www.datatables.net/ref#fnSort
  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    Yup fbas is spot on - you would need to attach calls to fnSort (or proxy them to those elements which do have the listener added automatically by DataTables) to have all cells in the table act in the way you are looking for.

    Allan
This discussion has been closed.