I am trying to get an object of a jQuery Data Table using JQuery. I am using this thread to accomplish this:
https://datatables.net/forums/discussion/2913/how-to-get-the-otable-datatable-object-from-the-tables-id
For some reason this does not work. When I call $('.dynamic-wide-table').dataTable();
it causes my table to initialize AGAIN and make the table render twice, like so:
According to the link posted above it should NOT be doing that, but instead just fetch the object.
Here is my code:
main.js
(loaded into HTML head of every page)
$(document).ready(function() {
$(".dynamic-wide-table").dataTable({
"aaSorting": [],
"scrollX": true,
"scrollY": 530,
"scrollCollapse": true,
"lengthMenu": [
[100, 400, 1000, 5000, -1],
[100, 400, 1000, 5000, "All"]
],
"retrieve": true
});
});
get object:
$(document).ready(function() {
$('.dynamic-wide-table').dataTable();
});