I have the following in my server-side php and I would like to sort it by id and not month...
$out=Editor::inst( $db, 'lk_months', 'id')
Field::inst( 'id' ),
Field::inst( 'month' )
This question has an accepted answers - jump to answer
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.
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.
Ok. Thank you Allan. I'll give those a try.
It looks like you're new here. If you want to get involved, click one of these buttons!
DataTables designed and created by SpryMedia Ltd.
SpryMedia Ltd is registered in Scotland, company no. SC456502.