0
我有一个代码:数据表服务器端处理
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
});
}
});
}
功能prepareListCustomer()将数据写入到listCustomre。我想在prepareDataTable中显示这些数据,怎么样? 我想使用服务器端处理。在listCustomer我喜欢JSON:
{
"rowsPerPage": 10,
"page": 1,
"total": 100,
"rows": [
{
"id": 1,
"name": "nazwa1"
},
{
"id": 2,
"name": "nazwa2"
},
{
"id": 3,
"name": "nazwa3"
}
]
}
我读书http://datatables.net/examples/data_sources/server_side.html但我不知道如何实现我的代码?