WordPress.org

Ready to get started?Download WordPress

Forums

TablePress
[resolved] Dates Sorting (6 posts)

  1. elevensuns
    Member
    Posted 1 year ago #

    Hi there, i have a table on which i'm using sort in of different kinds.

    http://www.asensiopartners.com/?page_id=10

    I'm having problems with the dates sorting. We're using American format mm/dd/yyyy.

    What's the best way to sort this format correctly? Thanks very much!

    Francis

    http://wordpress.org/extend/plugins/tablepress/

  2. TobiasBg
    Member
    Plugin Author

    Posted 1 year ago #

    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

  3. elevensuns
    Member
    Posted 1 year ago #

    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

  4. TobiasBg
    Member
    Plugin Author

    Posted 1 year ago #

    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

  5. elevensuns
    Member
    Posted 1 year ago #

    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

  6. TobiasBg
    Member
    Plugin Author

    Posted 1 year ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.