Rfreshing data table

Rfreshing data table

yevgyevg Posts: 1Questions: 0Answers: 0
edited April 2013 in General
Hi everyone,

I really need your help.

I have this javascript code :

$(document).ready(function() {
var alertTable;
alertTable = $('#alert-table').dataTable({
/* "aaSorting" : [],*/
"bJQueryUI": true,
"bProcessing" : true,
"bServerSide" : true,
//"cache" :false,
/*"sServerMethod": "POST",*/
"sAjaxSource": '{% url "backend.audit.ajaj" %}',
"aoColumns": [
{ sWidth: '10%' },
{ sWidth: '16%' },
{ sWidth: '16%' },
{ sWidth: '15%' },
{ sWidth: '19%' },
{ sWidth: '24%' /*, sClass: "activity-log-desc" */ },
],




});

My problem is that I want to refresh this table every 3 seconds to get the new rows from my table.
If I cancel the "bServerSide" : true I can use something like :

var newtimer = setInterval( function () {
alertTable.fnReloadAjax(null, null, true);
}, 3000 );

and then it works. But I must have the bServerProcessing set to true (and of course fnReloadAJax doesnt work with it...)
My serverside code is written in Django.

I tried all the suggestions here anout fnDraw and none of them work for me and my table doesnt refresh.

I'll be very glad for any help.

Thanks,

Yevgeny

Replies

  • allanallan Posts: 63,522Questions: 1Answers: 10,473 Site admin
    Simply call fnDraw every three seconds, rather than fnReloadAjax. That should be all that is needed.

    Allan
This discussion has been closed.