Chronological sorting of date-time column ? bizarre situation

Chronological sorting of date-time column ? bizarre situation

sunildonsunildon Posts: 40Questions: 7Answers: 0

Hi alan & co

This been eating my time like hell i cant find a patch to this one .
I am using jquery 1.7 and datatables 1.9.4

I am unable to sort perfectly the datatime column in my datatable .(data coming from database)

My test results are weird i.e it is sorting by date 1-31 (asc/dsc) and sadly month,year not taken into consideration . ""
I have aoColumns with {"stype":} .

I have no clue how to make things work in simplest of manner with in my limitations.

Any patch for this is appreciated & thank you

Answers

  • DaimianDaimian Posts: 62Questions: 1Answers: 15

    I have a Datatable with this working...
    What format is your datetime in? I have mine as "mm/dd/yyyy HH:MM".

    Datatables 1.9.4 can detect and sort date/time/datetime automatically.

  • sunildonsunildon Posts: 40Questions: 7Answers: 0
    edited July 2014

    Hi

    well but not happening in my case . my format looks like 30-05-2014 18:45:00 .

    Actually i'm converting datetime to string in controller and binding to my table . but when i try to keep like datetime i am getting something like /Date(1401436560000)/ but in sorted oder ? but how to display date

    Regards

  • DaimianDaimian Posts: 62Questions: 1Answers: 15

    I have not been able to find what formats are supported but you likely will need to change it.

    Try formatting the date and time mm/dd/yyyy hh:mm for a moment to see if it works.

  • sunildonsunildon Posts: 40Questions: 7Answers: 0

    yep will try that . but after i convert like you said there wont be any issue with my approach ?
    I used to bind to datatable as string will that work fine in controller ? i am passing json response to client side via ' sAjaxsource '.

    Conversion tips are helpful mate

  • DaimianDaimian Posts: 62Questions: 1Answers: 15

    If you continue to have issues you may need to help us out by posting an example online for us all to see. Here is a post on how to do that.

  • sunildonsunildon Posts: 40Questions: 7Answers: 0

    I would love to make things better to explain my issue but i am getting data from server i cant create my exact scenario in the link pointed out , conversion tips will do fine

This discussion has been closed.