Reputation: 135
I'm using Tablesorter to display data but it is displaying it in ascending order, I want to display it as descending so the latest addition to the table is always at the top. Here is my code:
// *** sort options
headers : {}, // set sorter, string, empty, locked order, sortInitialOrder, filter, etc.
ignoreCase : true, // ignore case while sorting
sortForce : null, // column(s) first sorted; always applied
sortList : [], // Initial sort order; applied initially; updated when manually sorted
sortAppend : null, // column(s) sorted last; always applied
sortStable : false, // when sorting two rows with exactly the same content, the original sort order is maintained
sortInitialOrder : 'desc', // sort direction on first click
sortLocaleCompare: false, // replace equivalent character (accented characters)
sortReset : false, // third click on the header will reset column to default - unsorted
sortRestart : false, // restart sort to "sortInitialOrder" when clicking on previously unsorted columns
Really unsure what to edit/change so any advice would be really appreciated.
I have removed the original code because it was not actually relevant to what I want to achieve. This is the sort options part of the js that i believe needs editing.
Upvotes: 1
Views: 720
Reputation: 135
I find solution, open jquerytablesorter js, then edit as follows:
- sortList : [[0,1]] - 0 is for first column and 1 is for descending. I find the info on: mottie.github.io/tablesorter/docs/#sortlist
Upvotes: 1