Stuck on processing when click to turn backward.
Stuck on processing when click to turn backward.
Description of problem:
When I page back the page stuck on processing. but the button is active that I can click to get data from server. Only the page rendering failed.
for example:
When I current on the page 1, I can click the page 2 to the page 2, In fact , I can click any page only if I go forward.
such as: page 1 to page 2, page 1 to page 3, or page 2 to page 3 and etc, everything is OK.
BUT,
When I page back, I found that the page is on the processing. no matter from which page i turn backward!
such as: page 2 to page 1, page 3 to page 1, or page 3 to page 2, all met the error.
My dataTable configurations as below:
function configDataTable(url, type, pageSize, lengthMenuParam, columns) {
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
return {
searching: false,
ordering: false,
autoWidth: true,
lengthChange: false,
pageLength: pageSize,
destroy: true,
serverSide: true,
stripeClasses: ["odd", "even"],
bProcessing: true,
ajax: function (data, callback, settings) {
pageSize = data.length;
start = data.start;
page = (start / pageSize) + 1;
$.ajax({
url: url + '?page=' + page + '&limit=' + pageSize,
type: type,
dataType: 'json',
data: {},
success: function (return_json) {
json = return_json;
var returnData = {};
returnData.draw = json.draw;
returnData.recordsTotal = json.total;
returnData.recordsFiltered = json.total;
returnData.data = json.data;
console.log(return_json);
callback(returnData);
},
});
},
columns,
};
}
Please kindly help me, I dont konw what happend. Thanks very much.
Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.
Answers
It looks like you're doing something very odd with
serverSide. The protocol is discussed here. Also see examples here.Cheers,
Colin