Hi,
I am trying to use grocery crud and data tables theme. I want my data table to auto refresh after a given a time interval. For this I have been using http://datatables.net/plug-ins/api#fnStandingRedraw along with java-script setInterval. This used to work when I had used data tables earlier without grocery crud. But with grocery crud how can I get this code working or what else could I do to auto refresh my data tables after a set interval
$.fn.dataTableExt.oApi.fnStandingRedraw = function(oSettings) {
//redraw to account for filtering and sorting
// concept here is that (for client side) there is a row got inserted at the end (for an add)
// or when a record was modified it could be in the middle of the table
// that is probably not supposed to be there - due to filtering / sorting
// so we need to re process filtering and sorting
// BUT - if it is server side - then this should be handled by the server - so skip this step
if(oSettings.oFeatures.bServerSide === false){
var before = oSettings._iDisplayStart;
oSettings.oApi._fnReDraw(oSettings);
//iDisplayStart has been reset to zero - so lets change it back
oSettings._iDisplayStart = before;
oSettings.oApi._fnCalculateEnd(oSettings);
}
//draw the 'current' page
oSettings.oApi._fnDraw(oSettings);
};
var auto_refresh = setInterval(
function ()
{
var oTable = $('#groceryCrudTable').dataTable();
/* Re-draw the table - you wouldn't want to do it here, but it's an example :-) */
oTable.fnStandingRedraw();
}, 60000);