What's wrong with my ordering??

What's wrong with my ordering??

Connorln3Connorln3 Posts: 6Questions: 3Answers: 0
edited March 2015 in Free community support

I cannot get the inital ordering I want to work, I want to sort column 5 descending AND column 1 ascending. It only is sorting by the first one (5 how it is presented below):

allTable = $('#allTable').DataTable({
      "order": [[ 5, 'desc' ],[1, 'asc']],
      "aLengthMenu": [[10, 25, 50], [10, 25, 50]],
      "processing": true,
      "serverSide": true,
      "ajax": "/parentclub/parentclub/allData",
      "rowCallback": function( row, data ) {
          if ( $.inArray(data.DT_RowId, selected) !== -1 ) {
              $(row).addClass('selected');
          }
      },
      /*"oLanguage": {
       "sInfo": "Got a total of _TOTAL_ entries to show (_START_ to _END_)"
      }*/
      "columnDefs": [
            {
                "targets": [ 0 ],
                "visible": false,
                "searchable": false,
            },
            { "bSortable": false, "aTargets": [ 3 ] }
        ]

    })

Answers

  • Connorln3Connorln3 Posts: 6Questions: 3Answers: 0

    I also tried using "aaSorting": [[ 5, 'desc'],[ 1, 'asc']] instead of order. still it wont sort on both.

  • LizaLiza Posts: 6Questions: 3Answers: 0

    Try to replace :

    "order": [[ 5, 'desc' ],[1, 'asc']],
    By

    'aaSorting': [[ 5, 'desc'],[ 1, 'asc' ] ],

  • Connorln3Connorln3 Posts: 6Questions: 3Answers: 0

    I tried that already, comment above yours.

  • allanallan Posts: 63,676Questions: 1Answers: 10,497 Site admin

    "serverSide": true,

    The ordering is being done at the server-side, so if there is a problem with the ordering, the problem is in /parentclub/parentclub/allData

    Allan

This discussion has been closed.