0

I have two data tables in my project. First one is taking data from an array in my hand,
data table #1:

$('#table1').dataTable({
  "sPaginationType": "full_numbers",
  "iDisplayLength": 25,
  "aaSorting": [[7,'desc'],[2,'desc']],
  "bStateSave": true
});

In above table I got the result sorted as expected. But for my second table, which uses an ajax request for data, is not sorted as expected,
data table #2

$('#table2').dataTable({
  processing: true,
  serverSide: true,
  ajax: 'a valid url',
  "aaSorting": [[3,'asc'],[0,'desc']],
  "bStateSave": false,
  "iDisplayLength": 25
});

I got the column with index 3 sorted but column with index 0 is not sorted for the same values of column 3. Do anyone is facing this kind of issue? Any help or suggestions invited.

2

1 Answer 1

1

If you use aDataSort instead of aaSorting , you can tell a column that it should do a multi-column sort rather than just by itself. - as said over here by datatable site admin allan.

For more detail about aDataSort, go at datatable

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks @yash. I will try it out ASAP.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.