sorting on a number of fields isn't working

sorting on a number of fields isn't working

docdoc Posts: 5Questions: 0Answers: 0
edited March 2009 in General
I'm having a problem with sorting on two fields in the linked files.

1) The release field contains data which contains two periods. Could this be causing a problem? Sorting outright breaks on it.
2) The date field seems to be sorting a bit oddly.

While the attached html may not validate due to mozilla's "Save page" function the same problems exists on the validating original.

http://www.skynet.ie/~doc/TasksArchive.zip

Thanks for working on DataTables, it's really cool.

Cheers
Dave

Replies

  • docdoc Posts: 5Questions: 0Answers: 0
    I just realised this should probably be in the bugs category. Apologies. I didn't see that until now.
  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin
    Hi Dave,

    I can't get your HTML to actually run (probably the "save as" as you say), however I believe I can answer your two points:

    1. DataTables will probably pick this up as a number unfortunately at the moment (I'll put a fix in for this in the next release). But perhaps what you could do, to get it sorting correctly (i.e. not a string - you could just set sType ="string" for that), is use a sorting plug-in which replaces the periods with nothing and the casts the result as a number.

    2. The date field requires Javascripts Date().parse() to be able to parse the string. If it can't then it won't use it as a date. So you need to make sure that your date formatting conforms to that. Otherwise, again, it's a case of using a custom sorting plug-in.

    Allan
  • docdoc Posts: 5Questions: 0Answers: 0
    Hey Allan
    Thanks for your response. I'll have a look into the second point and will see what I can come up with. For me the first point can wait until the next release as there's not a lot of time left for this project here.

    Thanks again for your effort.

    Regards
    Dave
This discussion has been closed.