Do I need to wait to initialize DataTables in document.ready when using server-side processing?
Do I need to wait to initialize DataTables in document.ready when using server-side processing?
dnorton
Posts: 6Questions: 1Answers: 0
All examples show the DataTables initialization occurring in document.ready, like this:
$(document).ready(function() {
$('#example').DataTable();
} );
When using server-side processing, the HTML rendered is just an empty table. Can I run the initialization in a script rendered at the bottom of the page without waiting for the ready function to be called?
This discussion has been closed.
Replies
As long as
$('#example').DataTable()
executes when theid=example
element is in the document then it will work. If you place the script after thetable
element, that should be just fine.Allan