Possible bug when calling draw() inside fnDrawCallback
Possible bug when calling draw() inside fnDrawCallback
I'm using a pseudo-recursive strategy to load DataTables as I type in a column-specific text box. Under a certain condition, once DataTables is done drawing, I want it to draw again with updated search information. However, I'm getting weird behavior when I call draw() from inside fnDrawCallback. It's still going through the pipeline (i.e. fnDrawCallback is called again), but it's not refreshing the table on the screen until I click inside the developer console (on Chrome).
Additionally, each row has an onclick() associated with it, and when I click a row while it's in this 'un-refreshed' state, it interprets the click twice. This makes it seem as though it's creating a whole other table directly on top of the first one. When I force it to refresh by clicking in the dev console, it stops interpreting clicks twice.
'fnDrawCallback': function(){
if(g_backLoad.length > 0){
for (var index in g_backLoad){
g_DataTable.column(index).search(g_backLoad[index]);
}
g_backLoad = [];
//Doesn't reliably re-draw the table
g_DataTable.draw();
}
},