Preserve "asSorting" ordering

Preserve "asSorting" ordering

deiandeian Posts: 4Questions: 0Answers: 0
edited October 2010 in General
Hello,

I have such configuration:
[code]"aoColumnDefs": [
{ "asSorting": [ "asc", "desc" ], "aTargets": [ 0 ] },
{ "bSortable": false, "aTargets": [ 1 ] },
{ "asSorting": [ "desc", "asc" ], "aTargets": [ 2 ] }
][/code]
In "column 2" I have a lot of equal values.
If I sort "column 2" the script sorts the equal values by "column 0".

That's fine.
But if sorting of "column 2" is DESC, sorting of "column 0" is also DESC etc.

Is it possible if there are equal values in "column 2",
to sort by "column 0", but always ASC?

Here is my example, click on "column 2":
http://www.maquett.com/_temp/datatables/test-01.html

Thank you

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    It's intentional that interaction - the reason being that the sorting is stable, and doing a 'desc' sort - so the order of the rows is reversed. It's not really anything to do with the first column, it's just that the third column has been revised - and therefore the rows have as well (and you see the result in the first column). So to work around this, one option is to detect the sort listener DataTables adds to the third column (unbind) and add your own which will do the sorting you want (fnSort( [[2,'asc'],[0,'asc']]) for example).

    Allan
This discussion has been closed.