table.ajax.reload() is undefined
table.ajax.reload() is undefined
tshrove
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?
table.dataTable({
...,
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
This discussion has been closed.
Answers
you should code: table.api().ajax.reload();
Thanks. That fixed it.
manual is confusing in its use of examples without explicit 'api' reference to the DT object
I second @msyposs, the manual is very confusing. It leads you to believe that:
is valid. But it has to be:
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?
Allan
Not reading the entire manual I missed that part as well, you should post both solutions, that would cut down on the confusion.
I also got the same issue.