Data in datatable but pagination stuck
Data in datatable but pagination stuck
jdbdline
Posts: 3Questions: 0Answers: 0
Hi All
When I load the page all the data is loaded but if I click on one of the pages to paginate nothing happens.
Please see my datatable code
dataTable = $('#dataTable').dataTable( {
"iDeferLoading": 1,
"sDom": "<'row'<'col-md-6'l><'col-md-6'f>r>t<'row'<'col-md-5'i><'col-md-7'p>>",
/* "sPaginationType": "bootstrap", */
"oLanguage": {
"sLengthMenu": "_MENU_ records per page"
},
"aaSorting" : [[1,'desc']],
"bPaginate": true,
"bJQueryUI": true,
'bServerSide' : true,
'bAutoWidth' : false,
"aLengthMenu" : <?=$this->my_functions->html_select_list_size()?>,
"iDisplayLength": <?=$this->my_functions->config_get('default_list_size')?>,
"sAjaxSource": '<?php echo site_url('accounting/ajax_age_history_filtered/')?>',
"bRetrieve" :true,
"sPaginationType": "full_numbers",
"aoColumnDefs":
[
{
"aTargets":[ 3 ],
"mRender": function(amt, type, full) {
if (amt > 0 || amt < 0){
return '<?=$currency?>'+' '+formatNum(amt);
} else {
return "";
}
}
},
{
"aTargets":[ 4 ],
"mRender": function(amt, type, full) {
if (amt > 0 || amt < 0){
return '<?=$currency?>'+' '+formatNum(amt);
} else {
return "";
}
}
},
{
"aTargets":[ 5 ],
"mRender": function(amt, type, full) {
if (amt > 0 || amt < 0){
return '<?=$currency?>'+' '+formatNum(amt);
} else {
return "";
}
}
},
{
"aTargets":[ 6 ],
"mRender": function(amt, type, full) {
if (amt > 0 || amt < 0){
return '<?=$currency?>'+' '+formatNum(amt);
} else {
return "";
}
}
},
{
"aTargets":[ 7 ],
"mRender": function(amt, type, full) {
if (amt > 0 || amt < 0){
return '<?=$currency?>'+' '+formatNum(amt);
} else {
return "";
}
}
},
{
"aTargets":[ 8 ],
"mRender": function(amt, type, full) {
if (amt > 0 || amt < 0){
return '<?=$currency?>'+' '+ formatNum(amt);
} else {
return "";
}
}
},
{
"aTargets":[9],
"mRender": function(amt, type, row) {
// var b1 = "<a class='btn btn-xs btn-success' href='<?=base_url('customers/edit')?>/"+row[2]+"' target='_blank' title='View Customer Details'><i class='fa fa-fw fa-th'></i></a>";
// return b1+' '+b2;
return '';
}
}
],
'aoColumns' :
[
{'bVisible' : false},
{ 'sType': 'natural', "sClass": "nobr" },
null,
{ 'sType': 'natural', "sClass": "alignRight nobr" },
{ 'sType': 'natural', "sClass": "alignRight nobr" },
{ 'sType': 'natural', "sClass": "alignRight nobr" },
{ 'sType': 'natural', "sClass": "alignRight nobr" },
{ 'sType': 'natural', "sClass": "alignRight nobr" },
{ 'sType': 'natural', "sClass": "alignRight nobr" },
{'bVisible' : false},
],
"fnRowCallback": function( nRow, aaData, iDisplayIndex ) {
$('#dataTable').fadeTo('fast', 1);
},
"fnDrawCallback": function(){
$('#dataTable').fadeTo('fast', 1);
},
'fnServerData': function(sSource, aoData, fnCallback)
{
var comparisonday = $('#comparisondate').val();
var postdata = {
comparisondate: comparisonday,
start_date: start_date,
end_date: end_date,
sSearch: ''
};
$.ajax
({
'dataType': 'json',
'type' : 'POST',
'url' : '<?php echo site_url('accounting/ajax_age_history_filtered/')?>',
'data' : postdata,
'success' : fnCallback
});
}
} );
Please see debugging link : http://debug.datatables.net/uregit
Any help will be appreciated.
Thanks
JD
Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.
This discussion has been closed.
Replies
My guess is that your server-side script isn't correctly returning the parameters needed for server-side processing. I can't see from the debugger what is being returns since you are using a custom function.
Can you show me the JSON that is returned when you click the "Next" pagination button please?
Allan