I have a Flask app and at some point a construct a complex query and display the results with datatables. This works fine, but I have a really large amount of rows so it takes a long time to render it. I have found out that I should implement side server processing for datatables but I can't figure out how. So far, I am sending the list of data from python into the template like this:
return render_template('show_entries.html', entries=meas[0])
where "meas[0]" contains the data from sqlite retrieved from the query. In "show_entries.html", I am rendering the table like this:
<table id="myTable" class="table table-striped" style="width:100%" >
<thead>
<tr>
<th>Time</th>
<th>Mean Current</th>
<th>Vapour Pressure</th>
<th>Mean Voltage</th>
<th>Temperature</th>
<th>Humidity</th>
<th>Bar Pressure</th>
<th>RPM</th>
<th>Wind Sector</th>
<th>Wind Speed</th>
<th>Air Density</th>
<th>DC Voltage</th>
<th>Power Sector</th>
<th>Furling Angle</th>
<th>Yaw Angle</th>
</tr>
</thead>
<tbody>
{% for row in entries %}
<tr>
<td>{{ row[1] }}</td>
<td>{{ row[2] }}</td>
<td>{{ row[3] }}</td>
<td>{{ row[4] }}</td>
<td>{{ row[5] }}</td>
<td>{{ row[6] }}</td>
<td>{{ row[7] }}</td>
<td>{{ row[8] }}</td>
<td>{{ row[9] }}</td>
<td>{{ row[10] }}</td>
<td>{{ row[11] }}</td>
<td>{{ row[12] }}</td>
<td>{{ row[13] }}</td>
<td>{{ row[14] }}</td>
<td>{{ row[15] }}</td>
</tr>
{% endfor %}
</tbody>
</table>
and the javascript for datatables:
<script>
$(document).ready(function(){
$('#myTable').dataTable();
});
</script>
As I have said, it displays the data correctly but takes a long time so I am asking if someone has made it work server side in a similar situation as I've tried some of the examples I found in the datatables documentation but I'm nowhere near it.