Support » Plugin: TablePress » Date order

  • Resolved ruthduncan

    (@ruthduncan)


    I have just installed Table press and love it. I sell workshops so to have them in date, venue or workshop order is fantastic. But – I am not a web designer, just self-taught. Our dates are 26/27 August or 2/3 November just with the date and the month.
    In my table, the dates are being ordered by the first number so all the dates starting with 1 first and then all the dates starting with 2 and so on regardless of the month, so they are not in order at all of the dates, only numbers. How can I change this as I don’t want to add 23/08/2017 for 23 August 2017??

    I have tried to download your additional plugin but having no success at loading it.
    many thanks
    Ruth

    The page I need help with: [log in to see the link]

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

    (@tobiasbg)

    Hi Ruth,

    thanks for your question, and sorry for the trouble.

    The problem here is not really the date format, but that you are using multiple days (2/3) in the cells. This basically means that the JavaScript code no longer recognizes the cell as a date (it’s not as smart as a human).

    The best workaround should be to add a hidden column to the table, where you add a machine-readable date in the US format, like 08/23/2017. Then, we can hide this column, but instruct the JavaScript code to use that for the sorting, instead of the nice human-readable format of the date.
    This is just a bit of extra work, see e.g. https://wordpress.org/support/topic/sorting-function-with-images/ and https://wordpress.org/support/topic/consolidating-columns-without-changing-sorting-options/ where this approach is explained (not for dates, but images or other text, but the approach is the same).

    Regards,
    Tobias

    Thread Starter ruthduncan

    (@ruthduncan)

    Many thanks. I’ve set up the extra column in US date format and entered the code. Here is my table -http://www.myofascialrelease.co.uk/workshop-dates-2017/
    but my dates are still not coming in order. I have used this code
    “columnDefs”: [ { “orderData”: [ 3 ], “targets”: [ 2 ] } ]
    as my hidden column is between date 2017 and cost column. I put it into the custom command in the JS entry in the edit page but I still cant get it to work. What am I doing wrong?

    many thanks
    Ruth

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi Ruth,

    that’s great progress! Now, it seems that you have hidden the column on the “Edit” screen (so that it appears with a red background there), right? Unfortunatley, this approach of hiding will not work here. Instead, please make the column visible again and then hide it using CSS code instead. For that, please add this to the “Custom CSS” textarea on the “Plugin Options” screen of TablePress:

    .tablepress-id-1 .column-4 {
      display: none;
    }

    Regards,
    Tobias

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Date order’ is closed to new replies.