fnReloadAjax callback not working

fnReloadAjax callback not working

manojthomasmanojthomas Posts: 6Questions: 0Answers: 0
edited January 2013 in DataTables 1.9
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]

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    In the plug-ins code:

    [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
  • manojthomasmanojthomas Posts: 6Questions: 0Answers: 0
    Thank you for the quick reply.

    So do i make the changes to the fnReloadAjax plugin? or are u suggesting i use fnDraw instead of fnReloadAjax ?
  • manojthomasmanojthomas Posts: 6Questions: 0Answers: 0
    cheers mate....sorry i know what u mean now,just got some really tired eyes.and thanks for making Datatables.You are a legend mate...
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    :-) No worries. Good to know it is doing the business for you.

    Allan
This discussion has been closed.