Support » Plugin: TablePress » Default "sort by date" problem

  • Resolved fenomeno0chris

    (@fenomeno0chris)



    Hello, Im using the latest version of TablePress and WordPress.
    First of all thank you very much Tobias for this great plugin!

    Unfortunately I have one problem and one question. I will start with the problem.
    I have used this code to sort my table by date on default:
    [table id=24 datatables_fixedheader="top" row_order="sort" row_order_sort_column="C" row_order_sort_direction="DESC" /]
    http://www.ps4source.de/ps4-spiele-liste/

    But all it does is too look at the first numbers of the date, instead of sorting it correctly by year, month and day. Strangely if I manually sort by “Release” than everything works as it should.

    Beside that I have a question.
    Is it possible to put the linked table on my sidebar without the search box and the “previous” & “next” buttons?

    https://wordpress.org/plugins/tablepress/

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

    (@tobiasbg)

    Hi,

    thanks for your post, and sorry for the trouble.

    The reason for this is that the Table Row Order Extension can only do alphabetic sorting, it can not take into account date formats 🙁
    For that, you could instruct the DataTables JS library to perform an initial date sorting by adding a “Custom Command” (“Eigene Befehle”) like

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

    on the table’s “Edit” screen.

    In order to show the table in the sidebar without search and pagination, you could use this Shortcode:

    [table id=24 use_datatables=false /]

    (This actually turns all JS features off. If you want to keep some of them, you can turn off the specific ones with other parameters, see https://tablepress.org/faq/documentation-shortcode-table/

    Regards,
    Tobias

    Thank you very much for your fast answer.
    The table is correctly sorted now.

    I have also tried to to sort the widget table, but it has also the same issue as you can see here: http://www.ps4source.de/test-review/

    Thats the code I have used:
    [table id=24 use_datatables=false hide_columns="2,4" hide_rows="12-200" row_order="sort" row_order_sort_column="C" row_order_sort_direction="DESC" /]

    Is it also possible to sort it DESC by date?

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    no, it’s the same problem. The Table Row Order Extension can not sort by dates, sorry 🙁
    You would have to allow the JS sorting and then initiate an automatic sorting using that “Custom Command”.

    Regards,
    Tobias

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Default "sort by date" problem’ is closed to new replies.