• Resolved swedishparker

    (@swedishparker)


    Hey Tobias, I’m having trouble sorting date ranges that include different years.

    I’m using the date format mm/dd/yyyy and for example, the 04/dd/2014 rows are sorted ahead of the 05/dd/2013 rows.

    If you go to this page and click on the Date column header, you’ll see what I mean:

    supracer.com/calendar/

    Any ideas?

    Thank you!
    – Chris

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

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

    (@tobiasbg)

    Hi Chris,

    thanks for your post, and sorry for the trouble.

    I’m not really sure why this happens, but it might be necessary to tell the DataTables JavaScript library (that TablePress uses for the sorting) to explicitely handle the first column as dates. To do that, please add this to the “Custom Commands” textfield on the “Edit” screen of the table:

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

    Regards,
    Tobias

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    I just found another possible reason for this: In the “Date” column, a few cells have HTML in them, like <a name="May">. Most likely this breaks the date sorting, so I recommend that you remove that, and maybe move those to a column that already does string sorting (because those will not break then).

    Regards,
    Tobias

    Thread Starter swedishparker

    (@swedishparker)

    Perfect!

    Thank you very much for your help (and for replying so quickly).

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    sure, no problem! You are very welcome!
    (You should now no longer need the “Custom Command”.)

    Best wishes,
    Tobias

    Hey Tobias,

    I am having issues with the java functionality. I experimented with the col span and it broken the sorting. I knew this was the case, but now, having removed the colspan, the java has not returned and any new tables I create will not allow me to use any Java functionality.

    I have tried removing the plugin and re installing but the database just returns the same forms etc.

    Any ideas how i can return the java functionality

    Thanks

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    as you have asked the same at http://wordpress.org/support/topic/sort-functionality-issues I have answered over there.

    Regards,
    Tobias

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Sorting dates that include different years’ is closed to new replies.