load jsp on ajax success in datatable is loosing pagination
load jsp on ajax success in datatable is loosing pagination
var table = $('#tbleDataGrid').DataTable({
//destroy:true,
orderCellsTop: true,
//fixedHeader: false,
stateSave: true,
"stateSaveCallback": function (settings, data) {
$.ajax( {
"url" : "/tableFilterDetail?action="+eventStatus+"&periodRange="+periodRange +"&lastRecordOflastPage="+lastRecordOfPagination +"&pagingAction="+pagingAction,
"data": data,
// "dataType": "json",
"type": "GET",
"success": function (response) {
$('#pageID').html(response);}
} );
}
After ajax success,I am loosing all the datatable properties.
Kindly support.Thanks in advance
Answers
With out a test case showing the issue ([which is required for support, per the forum rules) it is impossible to say what is going wrong. However, my guess is that with
$('#pageID').html(response);}
you are overwriting the HTML for the DataTable. But as I say, without a test case, I can’t be sure. Certainly, writing into the HTML for a state save callback seems like an odd thing to do.Allan
yes,that was the culprit ..
$('#pageID').html(response);
have added below line and pagination is working properly but unable to load save state..
$('#hometbleDataGrid').DataTable();
I can't return json as my data is huge in modelandview object and this is spring mvc project...
https://jsfiddle.net/4oLrsykx/
Thanks!!
Thanks for the test case, unfortunately it doesn't run. We need to be able to see the problem you want help with to be able to progress this,
Colin