table.ajax.reload() is undefined

table.ajax.reload() is undefined

tshrovetshrove Posts: 4Questions: 3Answers: 0

When using the reload function on the ajax object within a table. table.ajax.reload(); I get that ajax is undefined. Does anyone know what the problem may be?

ajax : 'url to ajax',
dataSrc : 'first_object_name',

table.ajax.reload(); ///// <<<<--------------- TypeError: cannot read property 'reload' of undefined 'ajax'

This question has an accepted answers - jump to answer


  • hungudgmhungudgm Posts: 3Questions: 1Answers: 1
    Answer ✓

    you should code: table.api().ajax.reload();

  • tshrovetshrove Posts: 4Questions: 3Answers: 0

    Thanks. That fixed it.

  • msypossmsyposs Posts: 1Questions: 0Answers: 0
    edited May 2014

    manual is confusing in its use of examples without explicit 'api' reference to the DT object

  • GlennGlenn Posts: 2Questions: 0Answers: 0

    I second @msyposs, the manual is very confusing. It leads you to believe that:


    is valid. But it has to be:

  • allanallan Posts: 54,881Questions: 1Answers: 8,601 Site admin

    Actually, the confusion here is over the difference between $().dataTable() which you are using and returns a jQuery object and the old DataTables API, and $().DataTable() which returns the new API instance.

    This is noted in the manual and FAQs - but I'm very interested to hear any suggestions you might have about how I can improve the documentation?


  • redfroredfro Posts: 1Questions: 0Answers: 0
    edited September 2014

    Not reading the entire manual I missed that part as well, you should post both solutions, that would cut down on the confusion.

  • assuncaoassuncao Posts: 1Questions: 0Answers: 0

    I also got the same issue.

This discussion has been closed.