Title: Second Level Sort
Last modified: November 30, 2016

---

# Second Level Sort

 *  Resolved [MKNN](https://wordpress.org/support/users/mknn/)
 * (@mknn)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/second-level-sort/)
 * Couldn’t locate this by searching, but can’t imagine this is the first time to
   ask for it–sorry for the duplication.
 * The question is how to sort by a second parameter (that is, sort by columnA, 
   if those match, then sort by columnB). Often, the trick is to just sort by columnB
   and then by columnA, but that doesn’t seem to work in the admin interface. Just
   thought–perhaps there is a way to do this via arguments in the shortcode?
 * As an example, [http://wfl.dmlco.com/statistics/10-tackles/](http://wfl.dmlco.com/statistics/10-tackles/).
   I would like it to sort by HIGH, and then, if there is a tie there, by GAMES.

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/second-level-sort/#post-8498568)
 * Hi,
 * thanks for your question, and sorry for the trouble.
 * Second-level sort is indeed not possible in the admin area (the sorting algorithm
   there is not very sophisticated).
 * You can however do a second-level sort on the frontend, by holding down the “
   Shift” key when sorting for the second column.
 * Regards,
    Tobias
 *  Thread Starter [MKNN](https://wordpress.org/support/users/mknn/)
 * (@mknn)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/second-level-sort/#post-8498582)
 * Is there any way to make a second level sort the “default” view for the table,
   so others visiting the page would also see it that way?
 * If not, consider this a feature request! (Unsure if you are still updating tablePress
   or just supporting it.)
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/second-level-sort/#post-8498728)
 * Hi,
 * no worries, TablePress will still receive updates! 🙂
 * You could instruct the DataTables JS library (that performs the sorting) to perform
   such two-level sorting when the page is opened. For that, just add this “Custom
   Command” on the table’s “Edit” screen:
    `"order": [ [ 0, 'asc' ], [ 1, 'asc' ]]`
   This example would perform ascending sorts on the first and then the second columns.(
   Note that the column numbers in this code start with 0, i.e. 0 refers to the 
   first column, 1 refers to the second column, etc.)
 * Regards,
    Tobias

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Second Level Sort’ is closed to new replies.

 * ![](https://ps.w.org/tablepress/assets/icon.svg?rev=3192944)
 * [TablePress - Tables in WordPress made easy](https://wordpress.org/plugins/tablepress/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/tablepress/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/tablepress/)
 * [Active Topics](https://wordpress.org/support/plugin/tablepress/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/tablepress/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/tablepress/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * Last activity: [9 years, 6 months ago](https://wordpress.org/support/topic/second-level-sort/#post-8498728)
 * Status: resolved