• Resolved tneorg

    (@tneorg)


    I think I almost have my citations table ready! The recent thread on date sorting brought about another issue for me. As you’ll see on my page the last column, dates are not perfectly consistent. I cannot find a way to get it to sort properly. Is this possible? Thanks!

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

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    thanks for your post, and sorry for the trouble.

    The problem here are cells like “not recorded” and similar. Due to these, the sorting algorithm switches to string instead of date sorting.
    If you can’t replace these cells with a date, I recommend using the approach described at https://ww.wp.xz.cn/support/topic/tablepress-sorting-dates/#post-9471448
    You would basically have to add a second but hidden column for the dates, where these entries would get a fake date.

    Regards,
    Tobias

    Thread Starter tneorg

    (@tneorg)

    Thanks. I’ve removed the text from the columns, but that hasn’t worked yet. Is it possible that all cells must have data in order to work?

    Thanks!

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    empty cells shouldn’t matter, from what I remember. However, the cell “0/0/1987” might also be a reason.

    You could also try forcing date sorting, but adding this to the “Custom Commands” textfield on the “Edit” screen of the table:

    "columnDefs": [ { "type": "date", "targets": [ 10 ] } ]
    

    Regards,
    Tobias

    Thread Starter tneorg

    (@tneorg)

    It was not the 0/0/1987 – It was simply adding the code you gave me above! Although the 0/0 did not sort at all, so I gave it a 1/1 and it is now in the list. Thanks yet again!

    Plugin Author Tobias Bäthge

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

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Sorting question with date data’ is closed to new replies.