ajax Object cannot be access from a derived instance of DataTables
ajax Object cannot be access from a derived instance of DataTables
mnrafg
Posts: 2Questions: 2Answers: 0
I think my issue can be simplified by writing a few lines of code here.
// The IIFEs are used just for
// simulating the real scenario.
(function() {
// Initializing DataTables
// this is in a local scope in somewhere
var dt = $('#my_table').dataTable({
'select': 'single',
'lengthChange': false
});
// Here I can access the ajax object
// and it works fine.
dt.ajax.reload();
})();
(function() {
// Somewhere else in a scope other than above
// I am trying to do as follow:
$('#my_table').dataTable().ajax.reload();
// but here I cannot access ajax object
})();
Another question is what is the difference between the following two approaches, are they the same?
// This works fine
$('#my_table').dataTable({
// options...
});
// But this also works
$('#my_table').DataTable({
// options...
});
Thanks in advance,
Any help will be greatly appreciated.
Nasir
This discussion has been closed.
Answers
I think your questions can be answered by reading this FAQ:
https://datatables.net/faqs/index#api
Kevin