Does DataTables support more than 2 sorting modes?

Does DataTables support more than 2 sorting modes?

elbasoelbaso Posts: 1Questions: 0Answers: 0
edited March 2012 in General
Hi,
I have a table that holds test results for individual parameters, which can be PASS/WARN/FAIL.
I have a column that contains a horizontal bar chart showing the percentages of each status for the given test parameter as colors.
E.g.: 60% green, 20% yellow, and 20% red for status counts of that breakdown.

I'm writing custom sort code, so I can sort by the percentages of passes, warns and fails.
Since I have 3 values to sort on for a single column, and I would like to allow both ascending and descending sorting for each, I'd need 6 different sorting modes for this column.

Does DataTables support more sorting modes than the basic asc/desc?

Right now, I've sort of hijacked the basic asc and desc modes to allow sorting by percentage of passes descending, and by percentage of fails descending on subsequent clicks. It feels incomplete.

Thanks for any help!

Replies

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    Yes - you need to write a sorting plug-in to apply the sort that you want ( http://datatables.net/development/sorting ) and use asSorting for the columns to tell DataTables what you want the sorting to be, but yes that is possible :-)

    Allan
This discussion has been closed.