WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Dates Sorting

[Resolved] Dates Sorting

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

    @tobiasbg

    Hi Francis,

    thanks for your post, and sorry for the trouble.

    I’m not exactly sure, but it might possible that you can not have single-digit values for “mm” or “dd” in the dates. There are a few cells where this is the case.
    Could you please change all of them to have leading zeros?

    Regards,
    Tobias

    Hi Tobias, thanks for your prompt response. This is a great addition to WordPress, thanks for making available!

    Unfortunately,correcting single digits didn’t fix the problem. Al dates are now showing two digits, years 4 digits, separator is “/”, and the incorrect sorting persists.

    As far as i see, it’s sorting by the first digits “month”, but it also need to take “year” into account, any ideas? thanks very much

    Francis

    Plugin Author TobiasBg

    @tobiasbg

    Hi,

    that’s strange. For some reason, the DataTables jS library is then not picking up the dates, I guess…
    Please try manually setting the data type, by adding this to the “Custom Commands” textfield in the “Features of the DataTables JavaScript library” section on the “Edit” screen of the table:

    "aoColumnDefs": [ { "sType": "date", "aTargets": [ 1 ] } ]

    Also, I recommend to check the “Table footer” checkbox for your table, as that makes sense due to the content in the last row.

    Regards,
    Tobias

    Hi Tobias, that worked very well, thanks very much.

    I have another question before i mark this thread resolved.

    I’m setting up the last row to show a total of a sum. How can i exclude this row from sorting? and if not possible? any advise on how to work around it? thanks
    Francis

    Plugin Author TobiasBg

    @tobiasbg

    Hi Francis,

    great to hear that this fixed it! 🙂

    To exclude that row from sorting, you’ll just have to make it the footer row. You have already checked the “Table footer” row, as I instructed you to, but that now turns the empty row at the end into the footer row. So, just delete the empty row at the very end, and you’ll be set.

    Regards,
    Tobias

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Resolved] Dates Sorting’ is closed to new replies.