Quantcast
Channel: DataTables 1.9 — DataTables forums
Viewing all articles
Browse latest Browse all 1816

How to always sort all columns by a last column, giving preference to existing sort options?

$
0
0
Hi,

I have a table that groups rows by different columns selected by the user. To perform the grouping it uses aaSortingFixed for the column being grouped at that moment.

Now I am in need to always sort by a last column Z. This sort by Z should be applied always in the last position, giving preference to any other sort options currently applied by the user.

I tried using aDataSort for every column, specifying Z as the last column to sort with. The problem is that this approach doesn't work as intended when aaSortingFixed points to a column that uses aDataSort. What happens is that aaSortingFixed will be applied first and will use aDataSort to also sort by Z, then the rest of the sort options will be applied AFTER the sorting by Z.

Here is a fiddle example of the problem: http://jsfiddle.net/HNTez/2/

Is there any option like aaSortingFixed but that applies the fixed sort at the end instead of at the beginning? If not, wouldn't it be a nice feature to have? It could be called aaSortingFixedLast for example.

Viewing all articles
Browse latest Browse all 1816

Trending Articles