• Resolved KEXINO

    (@kexino)


    Hi. Apologies for such a basic question. I’ve tried reading the documentation and searching here but I cannot find the answer.

    I’m using TablePress for a very basic list of 3 columns. The first column is the date, written in US format (mm/dd/yyyy). I simply want TablePress to list the table with the most-recent date entry at the top.

    I’ve tried using this shortcode:
    [table id=1 row_order=sort row_order_sort_column=A row_order_sort_direction=DESC /]
    but that just seems to sort by the first digits of the date. So if there’s an entry with the date 10/01/2018 and another entry with the date 11/01/2017, the second date gets displayed above the first.

    What do I need to do? Please help.

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

    (@tobiasbg)

    Hi,

    thanks for your post, and sorry for the trouble.

    Unfortunately, the Table Row Order Extension that you are using here does not understand date formats, thus it will not be helpful here. Instead, we could try triggering a sort when the page is loaded.
    For that, please try adding this to the “Custom Commands” text field on the table’s “Edit” screen:

    "order": [[ 0, 'desc' ]]
    

    Regards,
    Tobias

    Thread Starter KEXINO

    (@kexino)

    Hi Tobias, thanks so much for coming back to me so quickly.

    I added the code you proposed and it all looks good except for one rogue entry dated 2015 that’s appearing before entries dated more recently. I’ve checked the cell concerned to see if there’s anything else in there, but it all looks fine.

    Anything else I can try? Would it help if I sent you the page URL?

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    yes, please post the link to the page with the table where this happens! I’ll gladly take a look!

    Regards,
    Tobias

    Thread Starter KEXINO

    (@kexino)

    Thanks Tobias – that would be great.

    Page is https://dqtech.co/services/support/#versionhistory

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    that’s strange. Could you please try extending the command to

    "order": [[ 0, 'desc' ]], "columnDefs": [ { "type": "date", "targets": [ 0 ] } ]
    

    Regards,
    Tobias

    Thread Starter KEXINO

    (@kexino)

    Yes! That works.

    Thank you so much for your prompt help, Tobias. Much appreciated.

    Plugin Author TobiasBg

    (@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!

    Thread Starter KEXINO

    (@kexino)

    Have already done this!

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    thanks, I really appreciate it!

    Best wishes,
    Tobias

    Hi Tobias,

    I’ve got similar problem with sorting by date like KEXINO. I use hidden US format mm/dd/yyyy but it doesn’t work proper for 2018 and 2019 year. Today (27th Dec) it shows firstly 2019 date, should be days from 2018 first.

    In fourth column I’ve got EU format example: 28.12.2018 – 5 column 12/28/2018

    [table id=2?responsive=scroll responsive_breakpoint=phone row_order=sort row_order_sort_column=5 row_order_sort_direction=ASC filter_date=”future” filter_date_columns=”5″?cache_table_output=false/]

    Is it possible to solve it ?

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    thanks for your post, and sorry for the trouble.

    Which sorting are you referring to here? The Table Row Order Extension can not sort dates in a good way, only the JavaScript sorting can. Can you please post a link to the page with the table where this problem happens, so that I can take a direct look? Thanks!

    Regards,
    Tobias

    Can I send you it in private message ?

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    you can send it by email (the forums here don’t have private messages). The address is in the main plugin file “tablepress.php”.

    Regards,
    Tobias

    Thank you,
    I’ve sent it.

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    thanks! I have already replied ??

    Regards,
    Tobias

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘Sort by year’ is closed to new replies.