Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82033

DataTables server-side processing problem

$
0
0
I have a code:
function prepareListCustomer() {
	var req;
    req = new AjaxAdapter;
    req.dataType = 'json';
    return req.query('GET', LIST_CUSTOMER_URL, {rowsOnPage: k, page: l}, function(responseServer, status, xhr) {
        listCustomer = responseServer.dataListCustomer;
        l = l + 1;
      }, function(jqXHR, textStatus, errorThrown) {
          var exception;
          exception = jQuery.parseJSON(jqXHR.responseText);
          return showError(exception);
        });
}

function prepareDataTable() {
	$('#displayData').dataTable( {
	    "bProcessing": true,
	    "bServerSide": true,
	    "sAjaxSource": LIST_CUSTOMER_URL
	    "fnServerData": function ( sSource, aoData, fnCallback, oSettings ) {
	      oSettings.jqXHR = $.ajax( {
	        "dataType": 'json',
	        "type": "GET",
	        "url": LIST_CUSTOMER_URL,
	        "data": {rows: k, pages: l},
	        "success": prepareListCustomer
	      } );
	    }
	  } );
}

Function prepareListCustomer() write data to listCustomre. I want display this data in prepareDataTable, how?
I want use server-side processing. In listCustomer I have JSON like:

{
    "rowsPerPage": 10,
    "page": 1,
    "total": 100,
    "rows": [
        {
            "id": 1,
            "name": "nazwa1"
        },
        {
            "id": 2,
            "name": "nazwa2"
        },
        {
            "id": 3,
            "name": "nazwa3"
        }
    ]
}

I am reading http://datatables.net/examples/data_sources/server_side.html But I don't know how implement to my code?

Viewing all articles
Browse latest Browse all 82033

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>