Date parsed as string
Date parsed as string
Ironwil616
Posts: 50Questions: 0Answers: 0
I've read other posts on this, and thought the problem was to be fixed, but I'm still getting incorrect date sorting. Some date values can be empty. When I do the sort by date, it's almost correct, but obviously is doing a left to right string sort. Years end up out of order if the month/day combo is lesser/greater than another around it, and "12" for a month comes before "2".
Help!
Help!
This discussion has been closed.
Replies
are you setting an sType for that column? which are you using?
which date sorting routine(s) are you using or intend to use? plugins?
Our application sorts by date in a number of locations, but it keeps track of dates in "milliseconds since 1970" timestamp, so sorting is always accurate right to the millisecond. I have this value converted to a string on the client side instead of having the string sent from the server side.
But that's assuming server-side, and assuming you have access to the date as a plain old integer.
i believe it will solve your date problem
http://www.datatables.net/forums/discussion/6587/unidate-universal-date-sorting-plugin/p1
I'm not doing things server-side in this instance. One of the requirements for this table is to provide column-specific filters. Though server-side processing would certainly help performance (must run in IE, which renders dataTables horribly slow compared to Chrome), due to the large return sets I'm handling, doing this really makes the column filters a wasted effort, except for the drop-down lists. Those I populate from a limited known set of values from the server on the initial data grab, so they have all the possible values, even if none of the column's current values do. This also speeds up initialization, since the JavaScript has no need to grab data from the columns and create the select elements. When several columns used these filters created in JavaScript, IE brought that "stop script" dialog up. That's off-topic, but it's why I'm grabbing full data sets and then applying dataTables to the rendered table.
At any rate, I'll delve more into the date sorting later this week. Thanks for the replies.