How can I set the sort order of the SQL query?
How can I set the sort order of the SQL query?
This question has an accepted answers - jump to answer
This discussion has been closed.
This question has an accepted answers - jump to answer
Answers
The ordering is does automatically in the DataTable. Do you have
id
shown as a column in your DataTable? Can you use the debugger to give me a trace please - click the Upload button and then let me know what the debug code is.Thanks,
Allan
Hi Allan, What I meant was can I do a sort ASC/DESC when the database is queried. Clicking on the columns sorts fine but the months are sorting from April to September and I would like them sorted January-December. I didn't want the id shown in the table however it does sort it the way I'd like when I include the id in the table
.
Great product by the way. I am so glad I found it and purchased it.
Assuming you are using client-side processing, then using a sorting plug-in would be the way to do it. I had thought that there was one for month names, but I can't see it. The moment plug-in is a good option if you want to use that for flexible formatting.
If you are using server-side processing, then its the server that does the ordering (i.e. the SQL database), so assuming its a date/time field, it would just work automatically.
Allan
Ok. Thank you Allan. I'll give those a try.