Re: datable datetime column not sorting properly

22 views
Skip to first unread message

asgallant

unread,
Nov 16, 2012, 2:51:50 AM11/16/12
to google-visua...@googlegroups.com
From the behavior you describe, it sounds like your "dates" are actually strings.  Did you set up the DataTable with a "datetime" type column for your dates?

If they are proper dates and not strings, then the table will sort them properly; see example here: http://jsfiddle.net/asgallant/cGax8/

On Friday, November 16, 2012 1:48:22 AM UTC-5, surajit dey wrote:
I've data like:

17-09-2012 02:30:00
19-10-2012 09:54:32
19-10-2012 10:16:32
19-10-2012 10:18:34
19-10-2012 10:46:57
19-10-2012 10:48:38
25-10-2012 12:30:51
25-10-2012 13:57:04
26-09-2012 09:45:12

I'm suing datable, but I can't sort this data properly. When click on sort link 'arrow(up/down)' its always sort like that.

But I want the datetime field column properly sort. 
like: ASC
 17-09-2012 02:30:00       
26-09-2012 09:45:12
19-10-2012 09:54:32
19-10-2012 10:16:32
19-10-2012 10:18:34
19-10-2012 10:46:57
19-10-2012 10:48:38
25-10-2012 12:30:51
25-10-2012 13:57:04

or DESC
25-10-2012 13:57:04
25-10-2012 12:30:51
19-10-2012 10:48:38
19-10-2012 10:46:57
19-10-2012 10:18:34
19-10-2012 10:16:32
19-10-2012 09:54:32
26-09-2012 09:45:12
17-09-2012 02:30:00 
I've used above example in my application.js file but it doesn't work. I'm working rails application. If anyone help me to fix this asap, it is very urgent to me to fix this one.
Reply all
Reply to author
Forward
0 new messages