fnReloadAjax callback not working
fnReloadAjax callback not working
manojthomas
Posts: 6Questions: 0Answers: 0
Hi everyone,
I have got a page where I load applications based on it's status.I have got two tabs 'Accepted' and 'Pending', and I reload the datatable when the tabs are clicked.I'm using the fnReloadAjax plugin to do it but for some reason the callback function is not working.Would some one please advice the reason for it.
[code]
function Applications(){
var THIS = this;
this.getApplications = function(keywordsElem){
this.applicationsList = $('#applicationsList ').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": 'http://cms.com/api/private/dev/getApplications?status=a',
"aoColumns": [
{"mDataProp": "applicationid", "sWidth": "110px"},
{"mDataProp": "applicant", "sWidth": "350px" }
],
"sPaginationType": "full_numbers",
"bLengthChange": false,
"iDisplayLength": 10,
"oLanguage": {
"sProcessing": "Loading Applications",
"sInfo": "Total Applications : _TOTAL_, now showing _START_ to _END_"
},
"aaSorting": [[ 0, "asc" ]]
});
$('.tabs').on('click',function(){
var applicationstatus = $(this).data('applicationstatus');
THIS.applicationsList.fnReloadAjax('http://cms.com/api/private/dev/getApplications?status=' + applicationstatus ,function(){
console.log('applications loaded');//call back not working
});
})
}
}
var applications = new Applications();
applications.getApplications ();
[/code]
I have got a page where I load applications based on it's status.I have got two tabs 'Accepted' and 'Pending', and I reload the datatable when the tabs are clicked.I'm using the fnReloadAjax plugin to do it but for some reason the callback function is not working.Would some one please advice the reason for it.
[code]
function Applications(){
var THIS = this;
this.getApplications = function(keywordsElem){
this.applicationsList = $('#applicationsList ').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": 'http://cms.com/api/private/dev/getApplications?status=a',
"aoColumns": [
{"mDataProp": "applicationid", "sWidth": "110px"},
{"mDataProp": "applicant", "sWidth": "350px" }
],
"sPaginationType": "full_numbers",
"bLengthChange": false,
"iDisplayLength": 10,
"oLanguage": {
"sProcessing": "Loading Applications",
"sInfo": "Total Applications : _TOTAL_, now showing _START_ to _END_"
},
"aaSorting": [[ 0, "asc" ]]
});
$('.tabs').on('click',function(){
var applicationstatus = $(this).data('applicationstatus');
THIS.applicationsList.fnReloadAjax('http://cms.com/api/private/dev/getApplications?status=' + applicationstatus ,function(){
console.log('applications loaded');//call back not working
});
})
}
}
var applications = new Applications();
applications.getApplications ();
[/code]
This discussion has been closed.
Replies
[code]
// Server-side processing should just call fnDraw
if ( oSettings.oFeatures.bServerSide ) {
this.fnDraw();
return;
}
[/code]
That's the problem. I'd suggest calling fnDraw since you are using server-side processing, but you could also alter the plug-in to support the callback in that mode.
Allan
So do i make the changes to the fnReloadAjax plugin? or are u suggesting i use fnDraw instead of fnReloadAjax ?
Allan