Title: Sorting issues
Last modified: December 29, 2018

---

# Sorting issues

 *  Resolved [rakelbara](https://wordpress.org/support/users/rakelbara/)
 * (@rakelbara)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/sorting-issues-4/)
 * Hello Tobias
    I’m sorry to be bothering you but I have a sorting issue with a
   table that I hope you can help me with. I tried searching for answers in the 
   forum, but was unable to find the correct solution.
 * First of all, the table is in Icelandic but the 2nd column does not sort correctly(
   in Icelandic) alphabetically.
 * The Icelandic alphabet looks like this:
    A, Á, B, D, Ð, E, É, F, G, H, I, Í, 
   J, K, L, M, N, O, Ó, P, R, S, T, U, Ú, V, X, Y, Ý, Þ, Æ, Ö But if you look at
   the 2nd column, you can see that Á and Ó are placed before Þ, which is incorrect.
   I have added the locale to my shortcode so it now it looks like this: [table 
   id=12 datatables_locale=”is_IS” /]
 * But unfortunately that does not work.
 * —————-
    My second issue is with sorting the date. I would like to have the dates
   in Icelandic; like this f.ex.: 1. des. 2018 25. jan. 1992 12. sept. 1873 But 
   I could not get that to sort correctly – it only sorted by the first number like
   this: 1. des. 2018 12. sept. 1873 25. jan. 1992 Which is chronologically incorrect.
   So I changed the dates to this format: dd-mm-yyyy but it still would not sort
   correctly.
 * I have added the plugin “DataTables Sorting plugins” and tried adding:
    “columnDefs”:[{“
   type”: “formatted-num”, “targets”: [ 3 ] } ] and “columnDefs”: [ { “type”: “date-
   eu”, “targets”: [ 3 ] } ]
 * But nothing worked.
 * Do you have any ideas on how I could fix these two issues?
 * Thank you in advance
    Rakel
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fsorting-issues-4%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/sorting-issues-4/#post-11036157)
 * Hi,
 * thanks for your post, and sorry for the trouble.
 * Unfortunately, I don’t really have ideas here. The DataTables JavaScript library
   by default only supports the Latin alphabet (as this is directly implemented 
   in character encodings and therefore easy to sort). You would need a custom sorting
   algorithm for the Islandic alphabet, i.e. you would have to “teach” the JS library
   which order the letters are in.
    Unfortunately, I don’t know how that is possible,
   but can only point you to the DataTables documentation at [https://www.datatables.net/](https://www.datatables.net/)
 * The problem with the dates is very similar. The algorithm simply doesn’t know
   the Islandic month names. For this, I’d recommend the approach from [https://wordpress.org/support/topic/date-order-6/](https://wordpress.org/support/topic/date-order-6/)
 * Regards,
    Tobias
 *  Thread Starter [rakelbara](https://wordpress.org/support/users/rakelbara/)
 * (@rakelbara)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/sorting-issues-4/#post-11038250)
 * Hello again Tobias and thank you for your reply.
 * But should the “system” not be able to understand the date “dd-mm-yyyy” in the
   form 30-12-2018? That is a European standard for dates, I would think?
 * Best regards
    Rakel
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/sorting-issues-4/#post-11038453)
 * Hi,
 * the “date-eu” algorithm understands “dd.mm.yyyy” best, from what I can see.
    
   Could you please try that?
 * Regards,
    Tobias
 *  Thread Starter [rakelbara](https://wordpress.org/support/users/rakelbara/)
 * (@rakelbara)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/sorting-issues-4/#post-11038502)
 * Hi again
 * If I add
 * `“columnDefs”: [ { “type”: “date-eu”, “targets”: [ 3 ] } ]`
 * The sorting disappears. Should I try something else?
 * Best regards
    Rakel
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/sorting-issues-4/#post-11038681)
 * Hi Rakel,
 * you need to be careful with the quotation marks here:
 *     ```
       "columnDefs": [ { "type": "date-eu", "targets": [ 3 ] } ]
       ```
   
 * Also, please make sure that you installed and activated the TablePress Extension
   from [https://tablepress.org/extensions/datatables-sorting-plugins/](https://tablepress.org/extensions/datatables-sorting-plugins/)
   
   And finally, keep in mind that the 3 in this code would refer to the fourth column
   of the table (as counting the columns starts with 0).
 * Regards,
    Tobias
 *  Thread Starter [rakelbara](https://wordpress.org/support/users/rakelbara/)
 * (@rakelbara)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/sorting-issues-4/#post-11039600)
 * Hello Tobias
 * Thank you for your reply. I had not noticed the quotation marks, thanks for that
   tip.
    I have now changed the code to what you suggested: `"columnDefs": [ { "
   type": "date-eu", "targets": [ 2 ] } ]`
 * But now the sorting for column no. 2 is completely disabled. Any idea what could
   be wrong now?
 * The page is:
    [https://www.hafdal.dk/legstadaleit/index.php/skipsskadar/](https://www.hafdal.dk/legstadaleit/index.php/skipsskadar/)
 *  Thread Starter [rakelbara](https://wordpress.org/support/users/rakelbara/)
 * (@rakelbara)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/sorting-issues-4/#post-11039622)
 * Hello again!
    Sorry, I found a value in the column that was formatted incorrectly
   and once I fixed that, everything worked fine 🙂 Happy New Year! Best regards
   Rakel
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/sorting-issues-4/#post-11040018)
 * 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/plugin/tablepress/reviews/)
   here in the plugin directory. Thanks!

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

The topic ‘Sorting issues’ 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/)

 * 8 replies
 * 2 participants
 * Last reply from: [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * Last activity: [7 years, 5 months ago](https://wordpress.org/support/topic/sorting-issues-4/#post-11040018)
 * Status: resolved