Hi,
thanks for your post, and sorry for the trouble.
Can you please post a link to the page with the table where this problem happens, so that I can take a direct look? Thanks!
Regards,
Tobias
Hi,
thanks for the link! I’m not exactly sure, but most likely the cause for this is the “TBD” entries in the table. Unfortunately, the sorting algorithms of the DataTables JS entries don’t support text in date columns like that.
Regards,
Tobias
I took the text out, what is the custom command i should be entering?
Hi,
good. I’m not exactly sure how robust the date sorting is, but it might be necessary to remove empty cells as well, just as a heads-up.
Now, after looking at this again, I realize that there’s no sorting algorithm (for “month/year”) in the DataTables JS library by default. You would first have to add one and then adjust the “Custom Commands”.
An alternate an possibly easier approach would be to add a hidden column with a real date, which is then used for the actual sorting (while the user still sees just the month/year column). For examples on this (with different data), please take a look at https://wordpress.org/support/topic/sort-by-height?replies=4
(With this, empty cells and “TBD” cells should not be a problem, as you could simply give those an arbitrary date, either in the past or in the future).
Regards,
Tobias
Thanks Tobias, I was able to get this working with your instructions. my final custom command was:
“columnDefs”: [ { “visible”: false, “targets”: [ 4,5 ] }, { “orderData”: [ 4 ], “targets”: [ 2 ] }, { “orderData”: [ 5 ], “targets”: [ 3 ] } ]
I added two more columns (4,5) with a date format that is sortable in tablepress (mm/dd/yyyy) hid them and sorted columns (2,3) by the data stored in columns (4,5).
Thanks for your excellent customer service and support!
Hi,
perfect! And 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!