0
votes

It is a follow-up question to my earlier question here. I am using Datatables with server side processing.

$('#dataTables1').DataTable({
        "bProcessing": true,
        "bPaginate": false,
        "serverSide": true,
        "ajax":{
                url :"get_user_data.php",
                type: "get",  // type of method  , by default would be get           
              },
        "columns": [  
        { "data": 'sno' } ,
        { "data": 'dob' } ,
        { "data": 'fullname' } ,
        { "data": 'email' }],
    });     

However, i would like to sort the data( loaded through Server side processing) on the client side. However, currently with the above code, when I click on the header of the column, it is again sending the request to the server which I would like to avoid.

1
Have you tried anything else?henrique romao

1 Answers

0
votes

As in the DataTables documentation:

DataTables has two fundamental modes of operation: Client-side processing - where filtering, paging and sorting calculations are all performed in the web-browser. Server-side processing - where filtering, paging and sorting calculations are all performed by a server.

https://datatables.net/reference/option/serverSide

So, initially this is not possible with the native DataTables API methods. As said by Allan:

Since in order to sort or filter, you need the full data set, which in server-side processing is only available at the server.


However, there is a discussion about this in this topic. And it is mentioned a plug-in that enables filtration delay for keeping the browser more responsive while searching for a longer keyword.
I don't know if this is your concern. But it may help.