Hi,
thanks for your question, and sorry for the trouble.
I’m afraid that this will not really work like this 🙁
The “Custom Command” (with the Extension) would only sort on the frontend. You however want to sort by date when the table data is generated (I assume that you want the 5 newest rows).
This can not really be done automatically, because of the date format, but also because of the sorting.
Unfortunately, I don’t really see a solution here, except manually creating the desired order 🙁 (This should not be difficult, because you can simply drag and drop the rows into the new order on the “Edit” screen, by clicking and holding the row number.)
Regards,
Tobias
Hi,
Thanks for your help but we can’t just simply drag and drop as we want to sort 3 tables and it’s a waste of time.
Our main problem is that we can’t order by european dates.
We downloaded and activated the DataTables Sorting plugins Extension 1.0.
We had this custom command : »columnDefs »: [ { « type »: « date-eu », « targets »: [ 4 ] } ]
And we simplified the command :
[table id=2 hide_columns="6" /]
[table id=2 row_order=sort row_order_sort_column=E hide_columns="6"/]
Link to the result : http://tendance-talons.com/publicite
As you can see it’s an alphabetically order… What is wrong ?
Regards,
Thibault
Hi,
as mentioned above, the Table Row Order Extension is of no use here. It can not sort for European dates, so that you can remove it’s Shortcode parameter.
Using the “Custom Command”
"columnDefs": [ { "type": "date-eu", "targets": [ 4 ] } ]
is correct, but this only defines the data type. To perform an initial sorting, you’ll have to extend it to
"columnDefs": [ { "type": "date-eu", "targets": [ 4 ] } ], "order": [[ 4, 'asc' ]]
For the Shortcode, use
[table id=2 hide_columns="6" /]
Regards,
Tobias
Hi,
You’re fast ! Thank’s !
I copy/paste these instructions but nothing has change… ?
Our order is
table id=2 hide_columns="6"
And our “Custom Command” is now
"columnDefs": [ { "type": "date-eu", "targets": [ 4 ] } ], "order": [[ 4, 'asc' ]]
But as you can see (Link : http://tendance-talons.com/publicite) there isn’t an perform as initial sorting. Did we miss something ?
(The extensions are activated.)
Regards,
Thibault
Hi,
you must enable the “Sorting” checkbox on the table’s “Edit” screen.
Regards,
Tobias
Hi,
Finally it works, thank’s a lot !
Have a nice day,
Regards,
Thibault
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!