Row refreshing during pagination
Row refreshing during pagination
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.
Answers
Your test case doesn't run because of this:
Uncaught ReferenceError: allData is not defined
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.
The
ajax.reload()
API only works if you useajax
so it knows where to refresh the data from. Since you are usingdata
to load the data thenajax.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
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 ininitComplete
instead of using thetable
variable as using the variable doesn't always work. I addedvar api = this.api();
and replaced thetable
withapi
ininitComplete
.Kevin
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.
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
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:
Likely its due to this statement
table.ajax.reload(null, false);
. As I said before you aren't usingajax
so theajax.reloa()
won't work.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
Hi kevin,
Is there any way I can place the URL to the page without anyone else viewing it>
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