Ajax.reload() is not working when back to previous page after update chrome

Ajax.reload() is not working when back to previous page after update chrome

csacsa Posts: 1Questions: 0Answers: 0

Link to test case:
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem:

I have a dataTable list page and detail page.
When I modify data on detail page and back to dataTable list page(previous page), modified data is not updated on dataTable.
It was working well so far a few weeks ago.
I think reload() is not working when back to the previous page after i updated chrome browser.
Dose this happen only to me?
This is my code..

     var table = $('#PANEL').DataTable({
        paging: false,
        lengthChange: false,
        searching: true,
        ordering: true,
        info: true,
        autoWidth: false,
        retrieve: true,
        rowReorder: true,
        cache: false,
        columnDefs: [
          // { "orderDataType": "dom-text", "targets": [1] },
          // { "type": "numeric", "targets": [3] },
        ],
        
        dom: 'Bfrtip',
        destroy: true,
        ajax: {
          // url: url,
          type: "get",
          cache: false,
          // data: json,
          // dataType: "json"
        },
        buttons: ['copy', 'excel'],
        // order: [order],
        // search: {search: keyword},
      });
    
      $(document).ready(function() {
        survey_year = $('#survey_year').val();
        address1    = $('#address1').val();
        address2    = $('#address2').val();
        tv          = $('#tv').val();
        family      = $('#family').val();
        call_code   = $('#call_code').val();
        call_date = $('#call_date').val().split(' - ');
        sdate = "";
        edate = "";
        if (call_date.length == 2) {
          sdate = call_date[0].trim();
          edate = call_date[1].trim();
        }
    
        url = "/json/panel/recruits?survey_year="+survey_year+"&address1="+address1+"&address2="+address2+"&tv="+tv+"&family="+family+"&call_code="+call_code+"&sdate="+sdate+"&edate="+edate;
        order = eval($('#order').val());
        keyword = $('#keyword').val();
        
        table.ajax.url(url);
        table.ajax.reload();
        table.order(order);
        table.search( keyword );
        
      });

And I tried

    table.clear().draw(); 
    table.rows.add(data); 

It wasn't working too.
Please let me know how to update reload modified data when back to previous page.

Replies

  • kthorngrenkthorngren Posts: 21,443Questions: 26Answers: 4,974

    Its hard to say what the problem might be without seeing it to do some debugging of the code flow. Start by using the browser's network inspector tool. Verify that the XHR request is sent when you expect and that the XHR response has the data you expect. Doing this should help narrow down where the problem might be. Let us know what you find.

    If you still need help please post a link to your page or a test case replicating the issue.
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

Sign In or Register to comment.