How to call multiple fnDraw()'s in a row?
How to call multiple fnDraw()'s in a row?
I have a tabbed container with different data tables loaded simultaneously. On one of the tabs you can update information that is reflected across the others so my goal here was to make all of them reload their server side processed data. I thought I could do it simply with something like the function below (I 'remake' each table into a data table as some where giving me the 'element has no function .datatable()' error) but the ajax calls get in the way of each other and throw JSON formatting errors.
Is there some way to have these tables consecutively update without hardcoding a thread timeout. I also tried just to 'fnDestroy()' the other tables so that when the user went back to those tabs they would reload, but the fnDestroy left the data and everything instead of removing the table.
[code]function updateAllOpenDataTables(){
var tables = $j.fn.dataTable.fnTables();
for(x in tables){
tables[x] = $j(tables[x]).dataTable();
tables[x].dataTable().fnDraw();
}
}[/code]
Is there some way to have these tables consecutively update without hardcoding a thread timeout. I also tried just to 'fnDestroy()' the other tables so that when the user went back to those tabs they would reload, but the fnDestroy left the data and everything instead of removing the table.
[code]function updateAllOpenDataTables(){
var tables = $j.fn.dataTable.fnTables();
for(x in tables){
tables[x] = $j(tables[x]).dataTable();
tables[x].dataTable().fnDraw();
}
}[/code]
This discussion has been closed.
Replies
Allan