Multiple order doesn't work
Multiple order doesn't work
pippuccio76
Posts: 19Questions: 10Answers: 0
Hi , i have a table with 2 culumn order , one is type hour (european) one a number this is the link :
https://realizzazionesoftware.eu/software.fogliodiviaggio.it/index.php/test/lista_test
The date are ordered correctly but the culum NumFoglio is not ordered in desc Way.
F.E. in second page on date 29-08-2023 there are three record first il 547 than 546 and 548 (this must be the first)
Answers
The time column contains two different formats for the times - i.e.
9,30
and9:30
.In addition to that, DataTables doesn't detect HH:MM automatically. You'd need to delare the format as shown in this example.
Allan
Since you are using server side processing (
serverSide: true
) the server script is responsible for the table sorting. Are you using a Datatables supplied script?The data query in the server script will need debugging. Could be the column has a mixture of numeric data and text data.
Kevin
I missed that - nice spotting Kevin!
Allan
hi , this is the server side code :
Added $.fn.dataTable.moment( 'HH:mm');
Now the order on second page (29-08-2023) are 546-548-547
You can drop that if you are using server-side processing. It won't do anything.
I would suggest that the way to debug this is to have your server-side script dump the SQL that it is generating, so you can debug the ordering statements it is using.
Allan
Worth noting that your code appears to only order by a single column (
$dtpostData['order'][0]
). It doesn't take account of the fact thatorder
might be an array greater than length 1 (also note that it could be length 0!). You should use a loop there.Allan
I must change code only server side or both server side and client side ? Where i can find php server side code for multple order ?
Change my server side code :
Now it work