Title: Sorting with hidden column
Last modified: August 22, 2016

---

# Sorting with hidden column

 *  Resolved [AllanPedersen](https://wordpress.org/support/users/allanpedersen/)
 * (@allanpedersen)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/sorting-with-hidden-column/)
 * First of all, what a great plugin!
 * I have a table that has 6 columns. Column 0 is hidden and column 1 have image
   thumbnails. I want to be able to sort on the column with the thumbnails (1).
 * I have followed the advice in this post:
    [https://wordpress.org/support/topic/sorting-a-column-with-a-custom-date-format?replies=4](https://wordpress.org/support/topic/sorting-a-column-with-a-custom-date-format?replies=4)
 * When i apply the following custom commands sorting does not work on column 1 (
   the thumbnails):
    “aoColumnDefs”: [ { “iDataSort”: 0, “aTargets”: [ 1 ] }, { “
   bVisible”: false, “aTargets”: [ 0 ] } ]
 * If i unhide column 0 i am able to sort on column 0.
 * Am i missing anything in the above command ?
 * [https://wordpress.org/plugins/tablepress/](https://wordpress.org/plugins/tablepress/)

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

 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/sorting-with-hidden-column/#post-5556325)
 * Hi,
 * thanks for your question, and sorry for the trouble.
 * How are you hiding your first column here? Note that you can not hide it via 
   the “Hide” button on the “Edit” screen. It must be hidden via that JS command.
   
   Can you please post a link to the page with the table where this problem happens,
   so that I can take a direct look? Thanks!
 * Regards,
    Tobias
 *  Thread Starter [AllanPedersen](https://wordpress.org/support/users/allanpedersen/)
 * (@allanpedersen)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/sorting-with-hidden-column/#post-5556328)
 * Thanks for the quick reply.
 * I’m assuming that it is the { “bVisible”: false, “aTargets”: [ 0 ] } ] command
   that hides it.
 * Im not able to link to it because it is running internal. I can supply you with
   screendumbs or sourcecode.
 *  Thread Starter [AllanPedersen](https://wordpress.org/support/users/allanpedersen/)
 * (@allanpedersen)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/sorting-with-hidden-column/#post-5556333)
 * I think i understood you question now.
 * I hide it from the Custom Commands in the Features of the Datatables Javascript
   Library. There i added
 * “aoColumnDefs”: [ { “iDataSort”: 0, “aTargets”: [ 1 ] }, { “bVisible”: false,“
   aTargets”: [ 0 ] } ]
 * [Image](http://postimg.org/image/pjmbbkt4z/)
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/sorting-with-hidden-column/#post-5556334)
 * Hi,
 * correct, that’s the code that’s hiding the column. The other part of the code
   tells the JS library to use the data from column 0 when the user wants to sort
   column 1.
 * Just to be sure: Are you using the latest version of TablePress? The code changed
   there slightly (due to an updated version of the DataTables JS library), but 
   the old format is converted automatically, whenever the table is saved.
 * Screenshots and source code won’t really help, unfortunately, as I’d need to 
   inspect the page with the browser developer tools :-/
 * Regards,
    Tobias
 *  Thread Starter [AllanPedersen](https://wordpress.org/support/users/allanpedersen/)
 * (@allanpedersen)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/sorting-with-hidden-column/#post-5556338)
 * Im using Version 1.5.1 of TablePress and Version 1.0 of the DataTables Sorting
   extention.
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/sorting-with-hidden-column/#post-5556344)
 * Hi,
 * for which data format are you using the DataTables Sorting Plugins Extension?
   Can you try without that?
 * Regards,
    Tobias
 *  Thread Starter [AllanPedersen](https://wordpress.org/support/users/allanpedersen/)
 * (@allanpedersen)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/sorting-with-hidden-column/#post-5556521)
 * Hi again,
 * I have made a test site with a test table that shows you the issues im having:
 * [http://testsite.klisterpapir.dk/](http://testsite.klisterpapir.dk/)
 * Allan
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/sorting-with-hidden-column/#post-5556537)
 * Hi Allan,
 * thanks for the link!
 * I did some testing, and it might be possible that we are running into a tiny 
   issue with the data type of the `"orderData"` parameter, see [https://datatables.net/forums/discussion/comment/63908/#Comment_63908](https://datatables.net/forums/discussion/comment/63908/#Comment_63908)
 * The fix might be as easy as making the integer value an array. Can you therefore
   please try again with
 *     ```
       "aoColumnDefs": [ { "iDataSort": [ 0 ], "aTargets": [ 1 ] }, { "bVisible": false, "aTargets": [ 0 ] } ]
       ```
   
 * Regards,
    Tobias
 *  Thread Starter [AllanPedersen](https://wordpress.org/support/users/allanpedersen/)
 * (@allanpedersen)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/sorting-with-hidden-column/#post-5556539)
 * Hi Tobias,
 * Looks like I’ll be buying the beer next time I’m in Magdeburg….
 * Seems to be working perfect now!
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/sorting-with-hidden-column/#post-5556542)
 * Hi,
 * no problem, you are very welcome! 🙂 Good to hear that this helped!
 * Best wishes,
    Tobias
 * P.S.: In case you haven’t, please [rate TablePress](https://wordpress.org/support/view/plugin-reviews/tablepress)
   here in the plugin directory. Thanks!

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

The topic ‘Sorting with hidden column’ 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/)

 * 10 replies
 * 2 participants
 * Last reply from: [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * Last activity: [11 years, 5 months ago](https://wordpress.org/support/topic/sorting-with-hidden-column/#post-5556542)
 * Status: resolved