• Resolved baseballtimeintx

    (@baseballtimeintx)


    The date columns sort by numerical value rather than by date. Have tried adjusting settings and using different date formats.

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

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

    (@tobiasbg)

    Hi,

    thanks for your question, and sorry for the trouble.

    It seems that the sorting algorithm could not detect that the DOB column has dates in it. You could try manually setting the type. For that, please add this to the “Custom Commands” text field on the table’s “Edit” screen:

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

    Note that the other columns will still not sort correctly, as these are not “full” dates. To sort those by month/year, the best chance should be an approach like https://ww.wp.xz.cn/support/topic/date-order-6/

    Regards,
    Tobias

    Thread Starter baseballtimeintx

    (@baseballtimeintx)

    Thank you! I really appreciate the help and the quick response.

    Thread Starter baseballtimeintx

    (@baseballtimeintx)

    One more question. If I add a hidden column after the “Add to 40” column with complete dates and use that column to sort, would this be the correct custom command?

    “columnDefs”:[{“orderData”:[6], “targets”:[5]}, {“visible”:false,”targets”:[6]}]

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    no, from what I count, you’d need to use 6 and 7 in the code here. Counting the columns starts from 0 for the first column on the left.

    In addition, you’d need to merge the two "columnDefs" commands:

    "columnDefs": [ { "type": "date", "targets": [ 4 ] } ], { "orderData": [ 7 ], "targets": [ 6 ] }, { "visible": false, "targets": [ 7 ]  } ]
    

    Regards,
    Tobias

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

The topic ‘dates not sorting properly’ is closed to new replies.