• Resolved miss-d

    (@miss-d)


    Hi,

    I’d like to know if it’s possible to get a correct date sorting for the back- and front end in format dd.mm.yyyy –
    What we basically need to do is have a column “date” with date strings which we’d like to sort ascending via backend and which also should work with sorting on frontend.

    -or, as an alternative: A function that displays the newest entries on top of the table?

    Help!! ??

    BTW this is such a great plugin!!!!

    https://www.ads-software.com/extend/plugins/wp-table-reloaded/

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    thanks for your question.

    Yes, by default WP-Table Reloaded only supports English date format. I did however write an extension for the plugin some time ago that allows sorting of German dates at least on the frontend.
    Unfortunately, this is not possible on the backend, so you will have to live with English date sorting there, sorry. (A workaround might be to export the table to CSV, open that in Excel, sort there, and re-import the file into WP-Table Reloaded, replacing the existing table.)

    Here’s how to make it work on the frontend:
    You will need to download https://tobias.baethge.com/download/plugins/additional/wp-table-reloaded-german-data.zip and install and activate that just as a regular WordPress plugin.
    On the “Edit” screen of the table that has the German dates, then enter

    "aoColumnDefs": [ { "sType": "german_date", "aTargets": [ 2, 5 ] } ]

    into the “Custom Commands” textfield in the “DataTables JavaScript features” section.
    Adjust the numbers in the list at the end to the column numbers with the dates. Note that counting starts with 0, which means that in the example above, columns 3 and 6 would have German dates.

    Regards,
    Tobias

    Thread Starter miss-d

    (@miss-d)

    Thanks a lot for this Tobias!

    Can your code be modified so that the date column sorts “automatically”? Date ascending so that the newest entry is always on top? Regardless if its just entered under older entries in the backend?

    That’d be cool ??
    Thanks!

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    yes, that should be possible by extending the “Custom Command” with another piece of code, like

    "aoColumnDefs": [ { "sType": "german_date", "aTargets": [ 2, 5 ] } ], "aaSorting": [[2, 'asc']]

    This would enable German dates for columns 3 and 6 and do an initial sort on column 3. If the order is the wrong way, just change 'asc' to 'desc'.

    Regards,
    Tobias

    Thread Starter miss-d

    (@miss-d)

    Perfect!! Working as it should, thanks a looooooot!!!

    ??

    If you happen to do some future mods on backend sorting for date, pls let me know. For now this is exactly what we wanted.

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    awesome! Great to hear that this worked so easily. Thanks for the confirmation!

    Best wishes,
    Tobias

    Thread Starter miss-d

    (@miss-d)

    Hi Tobias,

    hmm can you help me again? We’ve been experiencing the problem that it sorts only by day and not also by month, so we had dates 31.08.2012 sorted before i.e. 04.09.2012 … can you help me here again? =)

    Thanks!

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    can you please post a link to the page with the table where this is happening? Otherwise, I can’t investigate this ??

    Regards,
    Tobias

    Thread Starter miss-d

    (@miss-d)

    https://www.asta.uni-mannheim.de/asta/service/jobborse/ when you click on sort by date (Datum) – if you list 100 results we dont have the September dates on top but somewhere under August… Thanks!! =)

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    that’s because the “Custom Commands” textfield in the “DataTables JavaScript features” section has the wrong column number for the “german_date” entry. If you change the 2 to a 4, it should work as expected.

    Regards,
    Tobias

    Thread Starter miss-d

    (@miss-d)

    ! Thanks ?? Working fine now – have a nice weekend!

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    great ?? Thanks a lot for the confirmation!

    Have a nice weekend, too!
    Tobias

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘[Plugin: WP-Table Reloaded] German date format to work with sorting’ is closed to new replies.