Data not loaded before DataTable call
Data not loaded before DataTable call

I'm trying to use DataTable on a table I'm generating with Python and a Jinja template.
My table isn't huge (about 200 records, 20 columns), however it seems like the DataTable function fires before the table is completely loaded. I get a "n is undefined" error in the JS console and none of the DataTable functionality loads. But if I limit my query to, say, 10 or fewer records, everything works perfectly.
I'm not great with javascript, so I'm not sure what to try. Does anyone have any suggestions? I've read about server-side processing. My table seems substantially smaller than some of the examples. Is this the path I should be going down?
Answers
Makes sense. Is there a callback you can use that is called after the Python and Jinja template finish populating the table to init Datatables?
Might be easier to just use an
ajax
request to your Python script and have it return JSON data to populate into the table. Like this example:https://datatables.net/examples/data_sources/ajax.html
Kevin