fnReloadAjax - How to Immediately load?

fnReloadAjax - How to Immediately load?

Alex67000Alex67000 Posts: 39Questions: 6Answers: 0
edited January 2013 in DataTables 1.9
Hi, i'm using fnReloadAjax, it's working well ! (;
But my tbody is only loaded after the setInterval.

[code]$(document).ready(function() {
var oTable = $('#example').dataTable( {
"aoColumnDefs": [{ "sType": "string", "bSortable": false, "aTargets": [ -1 ] }],
"oLanguage": {"sSearch": "Filter:"},
"bProcessing": false,
"sAjaxSource": 'results.txt',
"bPaginate": false,
"bLengthChange": false,
"bFilter": true,
"bSort": true,
"bInfo": false,
"bAutoWidth": false
} );
var newtimer = setInterval( function () {
oTable.fnReloadAjax();
}, 15000 );
} );[/code]

I want to know if it's possible to directly load the tbody, then refresh it every setInterval ? I have tried, but ..
Thanks (:

(When i'm on the page due to a submit on another page, then redirecting to the table page with an header : location.., i have to refresh by navigator (if i don't want to wait an update for example), and it's ok, but i don't want this, and i don't understand why the header:location don't refresh by itself?)

Replies

  • allanallan Posts: 63,389Questions: 1Answers: 10,450 Site admin
    That looks to me that it should load the data immediately, and then fresh it every 15 seconds. Can you link me to a test case showing the problem please?

    Allan
  • Alex67000Alex67000 Posts: 39Questions: 6Answers: 0
    Hi allan, thanks for your reply.
    I can"t give you a link for the moment ... but i've done some tests. And indeed the problem is caused by the redirection in PHP. If i go to the page with a link, or with a submit form, the data are loaded immediately.
  • Alex67000Alex67000 Posts: 39Questions: 6Answers: 0
    Page 1 : Submit Form (action = page check form)
    Page Check Form : (if all ok then header('Location: pageDatatables')
    redirection to :
    pageDatatables
    ok
    but
    refreshement
    not ok
    (must do F5).

    I think it's an not usual problem. But i don't understand. Maybe header:location, is just a strict redirection?
  • allanallan Posts: 63,389Questions: 1Answers: 10,450 Site admin
    In PHP? It should be okay. Do you get any Javascript errors on the console?
  • Alex67000Alex67000 Posts: 39Questions: 6Answers: 0
    edited January 2013
    I have no errors. And it's juste the table which is not refreshed. Other contents in the page are refreshed.
  • allanallan Posts: 63,389Questions: 1Answers: 10,450 Site admin
    Okay - I'd need a test case to understand the issue more completely then.

    Allan
  • Alex67000Alex67000 Posts: 39Questions: 6Answers: 0
    Okay, sorry, my bad.
    I was executing (creation, overwrite of the json file after executing the table).
    Sometimes .... i'm..

    Sorry for disarrangement allan. And a big thanks for your datatables! So goood!
  • allanallan Posts: 63,389Questions: 1Answers: 10,450 Site admin
    No problem - good to hear you got it sorted.

    Allan
This discussion has been closed.