How to include server side processing feature to this code which uses scrolling and no pagination?

How to include server side processing feature to this code which uses scrolling and no pagination?

ashwinidashwinid Posts: 1Questions: 1Answers: 0
edited February 2015 in Free community support

I get a list of all locations as a json object "data" . displayLocation function displays the json object in datatable with ScrollY. I want to add serverside processing to it .

noOfLocations = $("#noOfLocations").val();
$.ajax({
url : "getLocationList.action",
data : "title",
dataType : 'json',
contentType : 'application/json',
type : 'POST',
async : true,
success : function(res) {
var locationIndex = 1;
locationList = [];
for (var i = 0; i < res.locationList.length; i++) {
var data1 = [];
data1.push(locationIndex);
data1.push((res.locationList[i].id));
data1.push((res.locationList[i].locationId));
data1.push((res.locationList[i].locationName));

            data.push(data1);
            locationList.push(data1);
            locationIndex++;
        }
        displayLocationList(data);
        var count = $('#dataTable').dataTable();
        rowscount = count.fnGetData().length;
        // Get the length
        $("#addRows").text(noOfLocations - count.fnGetData().length);
    }

});

function displayLocationList(data) {
var table = $("#dataTable").dataTable({
"data" : data,
"scrollY" : 150,
"scrollCollapse": true,
paging : false,
"searching" : true,
"info" : false,
"columns" : [ {
"title" : "Location #"
}, {
"title" : "ID",
className : "hide",
"searchable" : false,
}, {
"title" : "Location ID"
}, {
"title" : "Location"
} ],

        "order" : [ [ 1, 'asc' ] ]

    });

    $('#dataTable tbody').on('click', 'tr', function() {

        selectedId = $('td', this).eq(1).text();
        selectedLocationId = $('td', this).eq(2).text();
        locationName = $('td', this).eq(3).text();

        $("#locationName").val(locationName);

    });
}

});

This discussion has been closed.