Hiding tables for update
Hiding tables for update
Hi all,
Just started using DataTables for a dashboard project.
JSON provides the data on which the table is based and is periodically updated which requires a refresh of the table. So far, I have implemented this as clearing the table followed by effectively filling it from scratch:
[code]
myTable.fnClearTable();
$.getJSON("sample.json", function(json){
processJSON(json); /*processes JSON and fills myTable*/
});
[/code]
Although this works, the table flickers between content and the 'No matching columns' message. How would I be able to prevent this from happening? Is there a mechanism that allows me to effectively switch off table redraw while I update the content?
Thanks for your help!
Wimster
Just started using DataTables for a dashboard project.
JSON provides the data on which the table is based and is periodically updated which requires a refresh of the table. So far, I have implemented this as clearing the table followed by effectively filling it from scratch:
[code]
myTable.fnClearTable();
$.getJSON("sample.json", function(json){
processJSON(json); /*processes JSON and fills myTable*/
});
[/code]
Although this works, the table flickers between content and the 'No matching columns' message. How would I be able to prevent this from happening? Is there a mechanism that allows me to effectively switch off table redraw while I update the content?
Thanks for your help!
Wimster
This discussion has been closed.
Replies
One quick little change to your code should do the trick:
[code]
$.getJSON("sample.json", function(json){
myTable.fnClearTable();
processJSON(json); /*processes JSON and fills myTable*/
});
[/code]
Also, just incase you missed it, there is the fnReloadAjax function ( http://datatables.net/plug-ins/api#fnReloadAjax ) which you might be interested in (although, you've basically re-implemented it here!).
Regards,
Allan