How to sort a Transaction record?

How to sort a Transaction record?

zhenguangzhenguang Posts: 2Questions: 0Answers: 0
edited June 2012 in General
Hi,

I'd like to sort a ledger such that my table is in

0
1
2
3
4
5

I'd like the 1st page to be
3
4
5

And the second page to be
0
1
2

I've tried but i could only be able to get
page 1,
5
4
3

and second page
2
1
0

I'd like to use Datatable to sort the transaction record, such that when they click next, they will see the history log
[code]
$('#example').dataTable( {
"aaSorting": [[ 0, "desc" ]],
"bPaginate": true,
});
[/code]

Please advise!

Thanks in a million

Replies

  • allanallan Posts: 63,302Questions: 1Answers: 10,431 Site admin
    edited June 2012
    You would need to create a custom sorting function ( http://datatables.net/development/sorting ) to implementing sorting that is discontinuous such as this.

    Allan
  • zhenguangzhenguang Posts: 2Questions: 0Answers: 0
    I need to reverse the table rows appear from a aaSorting desc orders... any idea how can i reverse the current 'view' dataset?
  • allanallan Posts: 63,302Questions: 1Answers: 10,431 Site admin
    There is no concept of that in DataTables core at the mount - the sort applies to the full data set, not a subset. If you do want to sort only a subset, then you would need to create a sorting plug-in. Its not something I've done before I'm afraid (a subset sorting plug-in!) but it should be possible with all the information available. It might involve a fairly good understand of how DataTables sorts data - specifically the aiDisplay and aiDisplayMaster arrays. I'd suggest looking at the source for _fnSort in DataTables.

    Allan
This discussion has been closed.