• Resolved koikawa

    (@koikawa)


    Hi Tobias,

    I have used a hidden column (column 1) to sort the first column (column 0) by date, because column 0 sometimes has a single date, and other times a date range.

    When you go to the page, it is sorted earliest (Aug 18) to latest (Jan 20). When you click the sort arrow for that first column, it sorts instead by date month without regard to year (so all January trials, sorted by Month then Day then Year). My desired outcome is that the trials are sorted either earliest to latest, or latest to earliest. (So Aug 2018 through Jan 2020, or Jan 2020 through Aug 2018).

    My custom commands are:

    “columnDefs”: [ { “orderData”: [ 1 ], “targets”: [ 0 ] }, { “visible”: false, “targets”: [ 1 ] }, { “orderable”: false, “targets”: [ 2, 3, 4, 9,10 ] } ]

    If this can’t be done, it’s not that big a deal. ?? Love this plugin!

    Kristi

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

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    thanks for your post, and sorry for the trouble.

    For this, you will have to use a special date format in the now hidden date column, namely mm/dd/yyyy. After that, the sorting should work. If now, you could also change the command

    { "visible": false, "targets": [ 1 ] }
    

    to

    { "visible": false, "type": "date", "targets": [ 1 ] }
    

    Regards,
    Tobias

    Thread Starter koikawa

    (@koikawa)

    Thanks, Tobias! I changed the hidden column to mm/dd/yyyy and changed the custom commands, but it’s still not working.

    “columnDefs”: [ { “orderData”: [ 1 ], “targets”: [ 0 ] }, { “visible”: false, “type”: “date”, “targets”: [ 1 ] }, { “orderable”: false, “targets”: [ 2, 3, 4, 9,10 ] } ]

    I’ve made a page where I can mess around with it: https://usbcha.com/test-page-for-hidden-column-sort/

    Can you tell me what I’m missing?

    Thanks so much!

    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    that doesn’t seem to be the “Custom Command” that is used on that page? There, it seems, the “Custom Command” is just

    "columnDefs": [ { "visible": false, "targets": [1] } ]
    

    Regards,
    Tobias

    Thread Starter koikawa

    (@koikawa)

    I’m so sorry! OK, the custom command is there now.

    Sorry!

    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    you have now copied the “Custom Command” with the “wrong” quotation marks. They need to be upright " and not curly .
    Could you please take a look at that? ??

    Regards,
    Tobias

    Thread Starter koikawa

    (@koikawa)

    Oh yay, it totally works! Such an amateur mistake, using the wrong quote. So sorry to waste your time!

    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 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Hidden sort issue’ is closed to new replies.