Title: Different default sorting for a table
Last modified: August 20, 2016

---

# Different default sorting for a table

 *  Resolved [Northwave](https://wordpress.org/support/users/northwave/)
 * (@northwave)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/different-default-sorting-for-a-table/)
 * Hi!
 * I have a table that I wish to use twice on the same page. The table has 11 columns
   of which two are hidden as default. In the first appearance of the table, all
   columns except the hidden ones are shown. Shortcode below:
 * `[table id=1 shortcodes_before_formulas=true plus_sign_positive_numbers="7"/]`
 * In the second appearance of the table (below the “first one”), I have with the
   help of shortcode hidden some columns and put the default-hidden ones to show
   up. Here’s the shortcode for the second appearance:
 * `[table id=1 print_description="false" hide_columns="4-6,8-9" show_columns="10,11"
   plus_sign_positive_numbers="4,5" /]`
 * For the table, I have some Custom Commands to apply default sorting etc:
 * `"aaSorting": [ [ 5, "desc" ], [ 3, "desc" ], [ 6, "desc" ], [ 2, "asc" ], [ 
   7, "asc" ], [ 0, "asc" ] ], "aoColumnDefs": [ { "asSorting": [ "desc", "asc" ],"
   aTargets": [ 2, 3, 4, 5, 6, 7, 8 ] } ], "bSortClasses": true`
 * Now, is it possible in some way to assign the same table different sorting than
   the default one, that’s in the Custom Commands? Because, now when I show the 
   table in the second appearance, the sorting is not working and i.e. the sorting
   arrows are not displayed. I assume it’s because I have hidden the columns 4-6
   and 8-9…
 * Thanks for some advice, and I hope there is some solution for this 🙂
 * [http://wordpress.org/extend/plugins/tablepress/](http://wordpress.org/extend/plugins/tablepress/)

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

 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/different-default-sorting-for-a-table/#post-3502992)
 * Hi,
 * thanks for your post.
 * Ah, having two different “Custom Commands” for the same table twice on a page
   is a problem 🙁 The reason is that there’s no Shortcode parameter for the “Custom
   Commands”, due to their complexity (and for security reasons). So, I’m not really
   sure what you could do here.
    The best solution would probably be to use two 
   tables that have the same data. For each one, you can then set a different content
   in the “Custom Commands” field. Do you know what I mean?
 * Regards,
    Tobias
 *  Thread Starter [Northwave](https://wordpress.org/support/users/northwave/)
 * (@northwave)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/different-default-sorting-for-a-table/#post-3503040)
 * Hi,
 * okay, yes I know what you mean. However, I don’t like the idea of having a duplicate
   table (that also have to be updated regularly). Well, I have to see if I come
   up with some other solution.
 * Thanks again! 🙂
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/different-default-sorting-for-a-table/#post-3503044)
 * Hi,
 * yes, a duplicate table would cause extra work 🙁 Sorry that I can’t offer a solution
   to this 🙁
 * Regards,
    Tobias

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

The topic ‘Different default sorting for a table’ 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: [13 years, 3 months ago](https://wordpress.org/support/topic/different-default-sorting-for-a-table/#post-3503044)
 * Status: resolved