Row refreshing during pagination

Row refreshing during pagination

bytecbytec Posts: 37Questions: 10Answers: 0

Hi All,
I have been working on this script for a few weeks and I have most of it working apart from one issue.
The script loads rows of data and automatically paginates all the pages in a continuous loop.

The rows of data are displayed from top to bottom producing a smooth display. The issue I have is when the
page performs a data refresh using "table.ajax.reload( null, false );" the rows load fast in stead of the smooth display.

The smooth loading a rows uses:

$("table tbody tr").hide();
$("table tbody tr").each(function(index){
  $(this).delay(index*dropdown).show(dropdownspeed);
  console.log("RUN REFRESH" );
  table.ajax.reload( null, false );
});

I have also so noticed that when the refresh runs the browser developer tool displays the following:

I have tried to create a test case but for some reason the test case version of my script does not run.

Can anyone see why the data refresh is not loading using the above code.

Test case.

http://live.datatables.net/wabequba/1/edit

Answers

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395

    Your test case doesn't run because of this:

    Uncaught ReferenceError: allData is not defined

  • bytecbytec Posts: 37Questions: 10Answers: 0

    Hi tangerine, I have the test data in the HTML section of the test case. If I remove the allData variable no data is shown. I am sure how to fix that issue for the test case. In my working script the data is fetched using an ajax call but I can't use that in the test case. Do you have any idea how I can fix it.

  • kthorngrenkthorngren Posts: 21,322Questions: 26Answers: 4,948

    The ajax.reload() API only works if you use ajax so it knows where to refresh the data from. Since you are using data to load the data then ajax.reload() isn't doing anything.

    Are you just wanting to go back to page 1 and start the process again or do you want to reload new data into Datatables?

    Kevin

  • kthorngrenkthorngren Posts: 21,322Questions: 26Answers: 4,948

    I updated your test case so it runs:
    http://live.datatables.net/wabequba/3/edit

    I comment out //data: allData, to use the HTML data and remove the error Tangerine mentioned. Also its best practice to get an instance of the Datatable API in initComplete instead of using the table variable as using the variable doesn't always work. I added var api = this.api(); and replaced the table with api in initComplete.

    Kevin

  • bytecbytec Posts: 37Questions: 10Answers: 0

    Hi Kevin, many thanks for taking the time to help. if I nucomment the section that performs the refresh the test case produces an error.

    function datarefresh() {
      $("table tbody tr").hide();
      $("table tbody tr").each(function(index) {
         $(this).delay(index * dropdown).show(dropdownspeed);
         console.log("RUN REFRESH");
         table.ajax.reload(null, false);
       });
     }
     datareload = datareload + datareloadplus;
    setTimeout(datarefresh, datareload);
    

    In the script I am developing it runs and call an ajax request using "datafids.php but does produce the following when I look in the developer tools in the browser.

    It looks like it fails to get the data 11 times which is the same as the number of rows per page. When I look at the failed calls it says:

    "Failed to load response data. No data found for resource with given identifier."

    Any ideas what would be causing this.

    Many thanks

  • kthorngrenkthorngren Posts: 21,322Questions: 26Answers: 4,948

    if I nucomment the section that performs the refresh the test case produces an error.

    FYI, when you updated the live.datatables.netw examples you will get a new URL. Your test case is now here:
    http://live.datatables.net/wabequba/5/edit

    You are getting this error:

    DataTables warning: table id=fidsTable - Invalid JSON response. For more information about this error, please see http://datatables.net/tn/1

    Likely its due to this statement table.ajax.reload(null, false);. As I said before you aren't using ajax so the ajax.reloa() won't work.

    In the script I am developing it runs and call an ajax request using "datafids.php but does produce the following when I look in the developer tools in the browser.
    "Failed to load response data. No data found for resource with given identifier."
    Any ideas what would be causing this.

    Without seeing the problem its hard to say. Please post a link to your page or update the test case to replicate the issue. If you aren't getting a response from the server then you will need to look at the server logs to debug the issue.

    Kevin

  • bytecbytec Posts: 37Questions: 10Answers: 0

    Hi kevin,

    Is there any way I can place the URL to the page without anyone else viewing it>

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    No, but you could PM myself or Allan, or Kevin if he's willing to take a look. Just click on your names and there's an option to PM.

    Colin

Sign In or Register to comment.