Datatable scroll with server side processing?

Datatable scroll with server side processing?

motguptamotgupta Posts: 19Questions: 5Answers: 0

I have below code

With below code I see data gets loaded first time and scroll is displayed. But when i hit scroll bar ajax call does not go to server

Also once ajax call goes, how to display the json data returned from server ? I did not get any good example on google related to scrolling with
server side processing ?

function(){
       oTable=      $('#customerTable').dataTable({
                    "bJQueryUI": true,
                    "iDisplayStart":0,
                    "iDisplayLength": 10,
                    "bRetrieve": true,
                    "bServerSide": true,
                    "bFilter": false,
                    "bInfo": false,
                    "bAutoWidth": false,
                    "aaSorting": [[1,'desc']],
                    "sScrollY": "600px",
                    "iScrollLoadGap": 50,
                    "sAjaxSource": "custom_url",
                     "ajax" : {
                                "url" : "custom_url"
                                "type" : "GET",
                                "data" : function(d) {

                                }
                            },
                    "aoColumns": [
                    {"aTargets": [0],"sName":"customer.fullName", "mData": function(response){
                        return response.customer.fullName;
                    }, "bSortable": false},
                    {"aTargets": [1],"sName":"updatedDate", "mData": function(response){
                        var updateDate = response.updatedDt;
                        return updateDate;
                    }, "bSortable": true},

                    ]

                    "fnDrawCallback": function(oSettings) {


                            }
                        });
            }

Answers

  • kthorngrenkthorngren Posts: 21,303Questions: 26Answers: 4,947

    It doesn't look like you are using the scroller extension. This extension will give you the ability to scroll and fetch data using server side processing.

    Kevin

  • motguptamotgupta Posts: 19Questions: 5Answers: 0

    Kevin you are right . Looks like i need to install scroller-1.4.3 package.

    Two doubts

    1) Once ajax call goes, how to display the json data returned from server under callback. I did not find any example on google for the same

    2)Say datatable has loaded the data i.e. 20 rows from server on page loads. Now user hits the scroll bar to bottom, my question is will datatable fetch only next set of data(next 20 rows) from server and then add to already displayed 20 rows(loaded during first time) or it will fetch complete data 40 rows back from server

This discussion has been closed.