• Resolved gothriveblog

    (@gothriveblog)


    Please forgive this basic question but I looked throughout the support but could not find an answer. I have a table with dates in first column. I imported the source after making it a CSV file. If I do not do anything else it sorts the column numerically not in date sequence. I added the Datatables sorting plugin hoping that would work but I cannot find documentation on how to format the commands. I found this: “aoColumnDefs”: [ { “sType”: “date-eu”, “aTargets”: [ 0 ] } ] which sorts European dates but this is not what I need. I need American dates.
    The site is here: http://godesanatools.com/conferencecalls/
    I would appreciate your help very much.

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    thanks for your question, and sorry for the trouble.

    You should not need that Extension here, so that I suggest to remove it again. Instead, please try this “Custom Command”:
    "columnDefs": [ { "type": "date", "targets": [ 0 ] } ]

    Regards,
    Tobias

    Thread Starter gothriveblog

    (@gothriveblog)

    Thank you, that was what i needed. I could not find the solution you gave me in the documentation. Is it in there and did I just miss it?

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    Good to hear that this helped!
    This is not in the TablePress documentation but in the DataTables documentation at https://www.datatables.net/

    Usually, this is not necessary as DataTables can auto-detect formats, but for some reason that failed here, which is why the “Custom Command” is necessary.

    Regards,
    Tobias

    Hi Tobias,

    I have a similar problem with german date formats. We tried this line of command “columnDefs”: [ { “type”: “formatted-num”, “targets”: [ 1 ] } ] but it doesn’t work. Any idea?

    https://albionacademy.de/tabellen-test/

    Thanks in advance.

    Best,
    Thorsten

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi Thorsten,

    for you, it should actually be sufficient to force DataTables to use German as its language. This will work by setting the site’s language to German, or by adding a parameter to the Shortcode:
    [table id=23 datatables_locale="de_DE" /]
    You should then not need that “Custom Command”.

    Regards,
    Tobias

    Hi Tobi,

    thank you for your help. The locale did the trick :).

    Best,
    Thorsten

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    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 here in the plugin directory. Thanks!

    Hi Tobi,

    it’s me again. My client set up a new table with this shortcode [table id=testtable datatables_locale=”de_DE” /] but the date is not sorting correctly. Any ideas?

    https://albionacademy.de/testtable/

    Best,
    Thorsten

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi Thorsten,

    that’s strange… Please try forcing the date format by adding this to the “Custom Commands” (“Eigene Befehle”) text field on the table’s “Edit” screen:
    "columnDefs": [ { "type": "date", "targets": [ 2 ] } ]

    Regards,
    Tobias

    Hi Tobi,

    that sutom command didn’t work. Still confused why that happens? Sorry for not getting back earlier. Missed the email notification.

    Best,
    Thorsten

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi Thorsten,

    ok, you might then need the TablePress Extension from https://tablepress.org/extensions/datatables-sorting-plugins/

    After installing that, please also modify the “Custom Command” to
    "columnDefs": [ { "type": "date-eu", "targets": [ 2 ] } ]
    Regards,
    Tobias

    Hi Tobi,

    thanks for your quick response. It does work now.

    Thanks,
    Thorsten

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    great! Thanks for the confirmation!

    Best wishes,
    Tobias

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

The topic ‘Date Sequence in column’ is closed to new replies.