ajax Object cannot be access from a derived instance of DataTables
ajax Object cannot be access from a derived instance of DataTables
![mnrafg](https://secure.gravatar.com/avatar/7349156bd3507a4b608d1d2533a5da98/?default=https%3A%2F%2Fvanillicon.com%2F7349156bd3507a4b608d1d2533a5da98_200.png&rating=g&size=120)
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