Jinja and DataTable refresh locally
Jinja and DataTable refresh locally
I am using jinja to parse data to my page table. This is done every few seconds. Basically a table of the following form is generated (25-50 rows)¨
Date | Number |
---|---|
Today | 100 |
Tomorrow | 1050 |
This is all running locally ("file://"), hence I cant just use ajax.reload(). In this case a simple page reload is not possible either.
Therefore I have been looking into the invalidate functionality to redraw my datatable every few second, based on the new data in table.
However I cant get this to work. This is my preliminary code:
$(document).ready(function() {
// Initialize table
var oTable = $("#dataSet").DataTable({
paging: false,
bFilter: false,
bInfo: false,
ordering: false
});
// Redraw table every second
setInterval( function () {
oTable.rows().invalidate().draw(false);
}, 10000 );
} );
I can see the new data in html-file, however I cant get the datatable to redraw based on this new data?
Can someone please explain why this is not working? Any hints or suggestions will be much appreciated!