Title: DataTables Sorting plugins not working
Last modified: August 20, 2016

---

# DataTables Sorting plugins not working

 *  Resolved [nedmic](https://wordpress.org/support/users/nedmic/)
 * (@nedmic)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/datatables-sorting-plugins-not-working/)
 * Hi,
    I installed the plugin ([http://tablepress.org/extensions/datatables-sorting-plugins/](http://tablepress.org/extensions/datatables-sorting-plugins/))
   but it doesn’t work when I try to sort columns by date (format dd.mm.yyyy). Or
   there is a custom command that I missed ?
 * [http://wordpress.org/extend/plugins/tablepress/](http://wordpress.org/extend/plugins/tablepress/)

Viewing 15 replies - 1 through 15 (of 16 total)

1 [2](https://wordpress.org/support/topic/datatables-sorting-plugins-not-working/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/datatables-sorting-plugins-not-working/page/2/?output_format=md)

 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/datatables-sorting-plugins-not-working/#post-3438012)
 * Hi,
 * did you also activate the new plugin in the WordPress admin area?
 * Then, please post a link to the page with the table where the sort is not working.
   I’ll gladly take a look!
 * Thanks!
    Tobias
 *  Thread Starter [nedmic](https://wordpress.org/support/users/nedmic/)
 * (@nedmic)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/datatables-sorting-plugins-not-working/#post-3438032)
 * I did;) and deactivated / reactivated it also.
 * You can find the page here : [http://www.alloprod.com/box-office/](http://www.alloprod.com/box-office/)
 * Note that I manually reorganized column (so it’s ok by default when you land 
   on the page), but if you click on the head column “sortie salle” or “sortie DVD”,
   sorting doesn’t work anymore.
 * Elements only sort by day (01 to 31 and vice versa).
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/datatables-sorting-plugins-not-working/#post-3438038)
 * Hi,
 * thanks for the link.
    I’m not really sure why the type is not detected automatically
   here. But we can set this manually, so it should work. Please add this to the“
   Custom Commands” text field in the “Features of the DataTables JavaScript library”
   section on the “Edit” screen of the table:
 *     ```
       "aoColumnDefs": [ { "sType": "date-eu", "aTargets": [ 3 ] } ]
       ```
   
 * Regards,
    Tobias
 *  Thread Starter [nedmic](https://wordpress.org/support/users/nedmic/)
 * (@nedmic)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/datatables-sorting-plugins-not-working/#post-3438056)
 * Thanks it works !
    But how can I also include column 8 (“sortie DVD”) to be sortable?
   I tried :
 * > “aoColumnDefs”: [ { “sType”: “date-eu”, “aTargets”: [ 3 , 8 ] } ]
 * With no success…
 * And I can’t sort 3rd column by default when landing on the page.
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/datatables-sorting-plugins-not-working/#post-3438058)
 * Hi,
 * for column 8, you need to add a 7 to the code, as the counting starts with 0.
   This might not always work though, because of the “Non” entries, but you’ll have
   to try.
 * The command for sorting by default can be added after a comma.
 * So, in total, you get
 *     ```
       "aoColumnDefs": [ { "sType": "date-eu", "aTargets": [ 3, 7 ] } ], "aaSorting": [[ 2, "asc" ]]
       ```
   
 * (The 2 means third column.)
 * Regards,
    Tobias
 *  Thread Starter [nedmic](https://wordpress.org/support/users/nedmic/)
 * (@nedmic)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/datatables-sorting-plugins-not-working/#post-3438063)
 * Yes I counted starting with 0, so I meant column 9 (“sortie dvd”) sorting column
   4 (“sortie salle”) by default.
 * So code is :
 * > “aoColumnDefs”: [ { “sType”: “date-eu”, “aTargets”: [ 3, 8 ] } ], “aaSorting”:[[
   > 3, “desc” ]]
 * But I can’t sort column 9 by clicking on arrows and the second part of the code
   doesn’t seem to work (arrow is highlighted but data don’t sort by desc).
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/datatables-sorting-plugins-not-working/#post-3438081)
 * Hi,
 * ah, I just noted another possible source for this issue: You have connected the
   first cells in the head row. This is not really supported by the JavaScript library
   and could be a reason for this. Please remove the `#colspan#` from that cell 
   to test this.
 * Regards,
    Tobias
 *  Thread Starter [nedmic](https://wordpress.org/support/users/nedmic/)
 * (@nedmic)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/datatables-sorting-plugins-not-working/#post-3438102)
 * Well done 😉
    Column 4 sorts by default when we land on the page. But… still 
   have this issue with column 9. Impossible to sort it by clicking on the arrow.
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/datatables-sorting-plugins-not-working/#post-3438113)
 * Hi,
 * great 🙂
 * I think the reason for that are the “Non” entries, and maybe the empty cells.
   Can you maybe change all “Non” entries to empty cells? If it still does not work,
   all cells will need a date.
 * Regards,
    Tobias
 *  Thread Starter [nedmic](https://wordpress.org/support/users/nedmic/)
 * (@nedmic)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/datatables-sorting-plugins-not-working/#post-3438141)
 * Perfect !
 * Empty cells solution doesn’t work, but with a date to each cell it does.
    I change
   for 00.00.0000 if I don’t have the release date.
 * Problem solved 😉
 * Thank you very much for your time and patience.
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/datatables-sorting-plugins-not-working/#post-3438156)
 * Hi,
 * awesome! Great to hear that this worked!
 * You could now actually try without extra “Custom Command” for the sorting type
   again. If you are lucky, it is now recognized automatically.
 * Best wishes,
    Tobias
 *  Thread Starter [nedmic](https://wordpress.org/support/users/nedmic/)
 * (@nedmic)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/datatables-sorting-plugins-not-working/#post-3438168)
 * Unfortunately it doesn’t keep the european date format if I remove the “aoColumnDefs”
   parameter.
    Maybe you could add the line on the plugin page as an example 😉
 * > “aoColumnDefs”: [ { “sType”: “date-eu”, “aTargets”: [ 3, 8 ] } ]
 *  Thread Starter [nedmic](https://wordpress.org/support/users/nedmic/)
 * (@nedmic)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/datatables-sorting-plugins-not-working/#post-3438178)
 * For information, I couldn’ find the datatables section which does not seem to
   exist.
    [http://tablepress.org/documentation/#datatables](http://tablepress.org/documentation/#datatables)
   But there is a link to it in “Table Options” > “Use JavaScript library” section.
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/datatables-sorting-plugins-not-working/#post-3438182)
 * Hi,
 * hhm, weird. The format was detected in my tests, when I used this the last time…
   But setting it manually with that “Custom Command” is better anyway, so just 
   keep that command 🙂
 * And thanks for the information about the links! It looks like I need to adjust
   all of them in the Documentation. (They no longer work because I changed the 
   HTML code…)
    The DataTables section is called “Features of the DataTables JavaScript
   Library”. (I need to extend that though, it doesn’t include a lot of information
   currently. One reason is that DataTables has its own documentation already at
   [http://www.datatables.net](http://www.datatables.net) ).
 * Best wishes,
    Tobias
 *  Thread Starter [nedmic](https://wordpress.org/support/users/nedmic/)
 * (@nedmic)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/datatables-sorting-plugins-not-working/#post-3438189)
 * Maybe because of the_date function I don’t know (it’s a french website).
    Anyway
   it works like a charm that way 😉
 * Indeed there is a lot of documentation on datatables.net but I think your explanations
   are much more comprehensive for novices like me.

Viewing 15 replies - 1 through 15 (of 16 total)

1 [2](https://wordpress.org/support/topic/datatables-sorting-plugins-not-working/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/datatables-sorting-plugins-not-working/page/2/?output_format=md)

The topic ‘DataTables Sorting plugins not working’ 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/)

 * 16 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/datatables-sorting-plugins-not-working/page/2/#post-3438192)
 * Status: resolved