fnReloadAjax is not working with the latest version (1.10)

fnReloadAjax is not working with the latest version (1.10)

alesnavalesnav Posts: 19Questions: 5Answers: 1
edited December 2013 in Bug reports
Hi there!

I am testing version 1.10 of DataTables (1_10_wip) and I love it! But I found a bug with the plugin fnReloadAjax (http://datatables.net/plug-ins/api#fnReloadAjax).

It does not work... something wrong with function fnServerParams, because I see the following error in Firebug:

-> this.oApi._fnServerParams is not a function

Allan, can you please check this?

Thanks!!

P.D.: I don't know if I may publish bugs of this dev version on Github... do you prefer them listed here or in Github?

Replies

  • allanallan Posts: 63,679Questions: 1Answers: 10,498 Site admin
    Hi,

    Yes, bug tracking in github is great. DataTables 1.10 has a reload Ajax method built in, `$().DataTable().ajax.reload();` (note the capital `D` to get the DataTables API instance). So fnReloadAjax is basically redundant now. However, given how often it is used, it is probably worth be updating the plug-in function to route the call to the new API so you only have to update the plug-in function, rather than ally he calling code. I'll make the change and commit it later on today.

    Allan
  • allanallan Posts: 63,679Questions: 1Answers: 10,498 Site admin
    I've just committed an update to the fnReloadAjax plug-in to allow it to work with 1.10.

    If you are writing new code, then using the new API would be best, but absolutely this plug-in (and the others - I'll get around to them...) should be made to work with 1.10.

    Allan
  • alesnavalesnav Posts: 19Questions: 5Answers: 1
    It works much faster than the previous version.

    One little bug in your code:

    Line 62: if ( typeof fnCallback == function' && fnCallback !== null )

    It should be:

    if ( typeof fnCallback == 'function' && fnCallback !== null )

    Thanks Allan!
  • allanallan Posts: 63,679Questions: 1Answers: 10,498 Site admin
    Oof - that looks like a bug in the syntax highlighter on the site. It is correct in github: https://github.com/DataTables/Plugins/blob/master/api/fnReloadAjax.js#L79 .

    I'll look into it - thanks!

    Allan
  • alesnavalesnav Posts: 19Questions: 5Answers: 1
    Nice! So, I think you can close this thread :)

    Thanks Allan!
This discussion has been closed.