Disabling sorting on server side
Disabling sorting on server side
reiki
Posts: 46Questions: 11Answers: 0
i got a server side set to true, but the sorting for column it still use datatable one , how do i disable it and let me control it ?
Answers
When you say, let you control it, do you mean by setting the default sort order? If that is the case, then you need to set
order
. If you want to disable ordering altogether, setordering
tofalse
,Colin
i mean by that is not from inisialization table when it click the header it will sort but its using datatables one
Setting
ordering
to false will disable Datatables sorting capabilities.Kevin
but if set it to false then i user cant click the header and datatable dont send the information for what column is it and what order isnt it ?
if i set
ordering
to false then i would not get this in the json :That is correct. We thought you wanted to disable sorting? I don't really understand what you are looking for if you want to disable sorting, but also keep it sending the
order
parameters?Allan
i want only to disable sorting by the datatables, right now if i press the header the sorting is done by datatables (i assume the datatables add
ORDER BY
to my query automatically) , now i want to turn that off but still send the information what column user click + the order. cause i wanna reorder them ondataSrc
its like specific caseIf you are using a Datatables supplied server script then yes I believe this is the case. You can change this to meet your requirements. What are you using for your server side processing script?
Please clarify what you mean by
dataSrc
. Are you referring toajax.dataSrc
?Kevin
yes i was refering to the
ajax.dataSrc
, basically in mydataSrc
i manipulate the data alot that changing the order of json fromORDER BY
query mess it up. for the server side iam using yajrabox and using laravel framework.this is my dataSrc yeah i know its long, basically iam transposing the json i get. Because i already tried transpose right from the query but it takes so long (because its process like 100k+ every query) thats why i proceed to use from datatables and js instead.
i just need the datatables not to put
ORDER BY
to my query and just sent the order information so that i can process it in dataSrc instead (by reversing the order of the array so its simpler)With server side processing enabled it is expected that the server script performs the sorting, searching and paging of the table data and returns only the rows to be displayed on the page. By default the page length is 10 rows. With server side processing the
ajax.dataSrc
should receive only 10 rows of data not 100k+ rows.With server side processing enabled Datatables isn't doing this - it is just sending the parameters to the server. Your server side script (yajrabox) is building the query. If you want to change the behavior then you will need to refer to the yajrabox documentation or developers to find out how to change the sorting behavior as required.
Kevin
yeah the reason why its 100k+ row is that it suppose to transpose first so it get smaller but now the transpose is in dataSrc, okay i try to find the doc for yajra about ordering cause i cant find what causing the order by automatically
theres also reason why i do this because enabling paging with the query (theres my other discussion about this here) return division by zero on page 2 and up and icant find the reason why its frustating
Guessing the problem is here?
You will need to do some debugging to track the value of
max
to see why its zero, ie, this statement:Kevin
ahh sorry forget to mention when enabling paging it was entirely different way i approach it not using any dataSrc, if you wanna see the code it was in my other discussion