I am using datatables as my grid on a webapp. The problem is, the user has to refresh the page always to get the current data from the database,is there a way this can be done automatically? because several apps write to the same table and the webapp is just for monitoring,but it beats the purpose if the user has to refresh the page to get the current data. here is my initialization code:
$('.{{datatable['class']}}').dataTable( {
"sDom": 'T<"clear">lfrtip',
"oTableTools": {
"sSwfPath": "includes/swf/copy_csv_xls_pdf.swf",
"aButtons": [
{
"sExtends":"copy",
"mColumns":[{{datatable['flds']}}]
},
{
"sExtends":"csv",
"mColumns":[{{datatable['flds']}}]
},
{
"sExtends":"xls",
"mColumns":[{{datatable['flds']}}]
},
{
"sExtends": "pdf",
"mColumns":[{{datatable['flds']}}],
"sPdfOrientation": "landscape",
"sPdfMessage": "{{datatable['title']}}"
}
]
},
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "{{datatable['source']}}",
"aoColumns": [
{% for column in 0..datatable['columns']-2 %}
null,
{% endfor %}
null
]
});
is there a way the list can be updating itself each time anything(UPDATE/INSERT/DELETE) happens to the datasource? i have implemented a loop as Danny suggested,
var int=self.setInterval(function(){oTable.fnDraw();},1000);
but the problem is that the list is always a funny state,see the attatched image