json / datetime

json / datetime

spidernet1979spidernet1979 Posts: 6Questions: 0Answers: 0
edited August 2010 in General
Hi!

Once again I have a little problem with my datatable. my datatable gets its data via json. one cell gets a release date and a time.

[code]
...
$datetime = mktime($hour, $min, $sec, $month, $day, $year);
$sOutput .= '"'.date("d/m/Y H:i:s, $datetime).'",';
...
return $sOutput;
[/code]

Now I have the problem that my date down but the time is up sorted. Is there a possibility that I can both on either sort up or sort down?

Lg
spidernet1979

Replies

  • XstreamINsanityXstreamINsanity Posts: 23Questions: 0Answers: 0
    You want to sort on multiple columns? Is that what you're asking? And do you want this to be the default or just a capability? Holding shift allows you to sort by multiple columns. The order of which you click the columns is the order in which they'll be sorted.
  • spidernet1979spidernet1979 Posts: 6Questions: 0Answers: 0
    No, I want to sort in one column. It should bei the default column.

    example of this cell (wrong):
    [code]
    09/08/2010 10:01:32
    09/08/2010 10:14:25
    08/08/2010 09:12:34
    08/08/2010 15:12:00
    [/code]

    example of this cell (right):
    [code]
    09/08/2010 10:14:25
    09/08/2010 10:01:32
    08/08/2010 15:12:00
    08/08/2010 09:12:34
    [/code]
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    If it's not a date / time format which is recognised by Date.parse() then you'll need to use a sorting plug-in which can sort it correctly. There are a number of these available and easy to customise: http://datatables.net/plug-ins/sorting

    Allan
This discussion has been closed.