"aaSorting": [[ -1, "desc" ]] gives error

"aaSorting": [[ -1, "desc" ]] gives error

nielslnielsl Posts: 8Questions: 1Answers: 0
edited January 2014 in Bug reports
With "aaSorting": [[ -1, "desc" ]] the error TypeError: aoColumns[srcCol] is undefined
is emitted. The table is uploaded to the debugger, code ohejav. aoColumns is optional
I assume .. very nice debugger .. well very nice everything.

Replies

  • allanallan Posts: 61,667Questions: 1Answers: 10,096 Site admin
    edited January 2014
    I'm not surprised it gives an error - what is column `-1` ? :-). Columns are array indexes, which are 0+.

    *edit* Ah - Are you thinking of aoColumnDefs and its ability to right count columns. Unfortunately this isn't available in aaSorting . You would need to know the number of columns and use the index for the last column.

    Allan
  • nielslnielsl Posts: 8Questions: 1Answers: 0
    edited January 2014
    Yes I was. I come from Perl, where array indices can be negative, and my perl-generated tables all have a variable and unpredictable number of columns .. the only thing about them is that it makes most sense to sort on the rightmost column by default ..
This discussion has been closed.