- Posts: 1
- Thank you received: 0
Hello,
I have recently picked up a task of sorting a grid view date.
The date is displayed as Gregorian, where the sorting becomes Alpha Numeric.
Any tips on this would be greatly appreciated.
**EDIT**
Sorry will be more specific.
I have a grid table display with multiple columns,
One of which is a Date Column.
The view is setup with DATE_FORMAT, where the database column is a mysql date format.
So the database table fields would be
2010-12-25 | TEXT | TEXT
The Generated view is DATE_FORMAT(datecol, '%M %Y') AS myDATE
Which Displays
December 2010 | TEXT | TEXT
Upon sorting the column in the display the dates are sorted Alphabetically instead of by Date.
Is there a way to sort it by date, rather than alphabetic?
Please Log in or Create an account to join the conversation.
I have been thinking about it. The best approximation you could get without great effort would be this: you can include numeric date format in your view and then set it as default sort field. You do not need to display this field on your page. So when your table is loaded it is sorted by date, but if you click to sort on any column this sorting would lost.
You can also try using secondary order by if you find it useful.
Regards
Please Log in or Create an account to join the conversation.
Hi, this isn't related directly to the question here, but it does have to do with date sorting. Take a look at the table view here:http://offnrunningsports.com/index.php?option=com_content&view=article&id=48&Itemid=57
Why is it sorting the year 2012 before 2011??? I have it sorting in ascending order, which means that 2011 comes before 2012!
Thanks.
Please Log in or Create an account to join the conversation.
Hi,
It appears that it sorts alphabetically. Does it work if you use a default format?
Please Log in or Create an account to join the conversation.