well I already tried that like this
[code]
max = oTable.fnPagingInfo().iTotalPages;
ctr=0;
setInterval(function(){
if (ctr <= max){
oTable.fnPageChange( 'next' );
ctr=ctr+1;
}
else{
oTable.fnPageChange( 'first' );
ctr=0;
}
},1000);
[/code]
and like this
[code]
if (ctr <= oTable.fnPagingInfo().iTotalPages){
}
[/code]
but it didn't work
[code]
ctr=0; // DEFAULT VALUE OF CTR
setInterval(function(){
if (ctr <= [ TOTAL NUMBER OF PAGE ]){
oTable.fnPageChange( 'next' );
ctr=ctr+1; // INCREASE VALUE OF CTR
}
else{
oTable.fnPageChange( 'first' );
ctr=0; // RESETS THE VALUE OF CTR TO 0
}
},1000);
[/code]
ctr is just a counter that increase each time the page change and resets when it reach the last page
Oops - sorry. I meant `max` . What is the plug-in telling you are the number of pages - that seems to me to be the point which might be most likely to fail.
[code]max = oTable.fnPagingInfo().iTotalPages; // JUST A TEST IF IT CAN GET THE VALUE OF oTable...
if (ctr <= max){
}[/code]
[code]
if (ctr <= oTable.fnPagingInfo().iTotalPages){ // TEST IF IT CAN WORK LIKE THIS
}[/code]
[quote]What is the plug-in telling you are the number of pages - that seems to me to be the point which might be most likely to fail.[/quote]
I have no idea about this one. I'm just searching for the value that will give me the total number of pages so i think that the plugin you were talking about is irrelevant.
yes it did but I can't use oTable.fnPagingInfo().iTotalPages for my if statement even if I do it like this
[code]
max = oTable.fnPagingInfo().iTotalPages; // MAX IS STILL NULL
[/code]
Sure - you can listen for the 'page' event and alter your code to clear the time out and then start a new one: http://datatables.net/docs/DataTables/1.9.3/#page
Replies
[code]
table.fnPageChange('next');
[/code]
Allan
well I ended up doing it like this but I cant find out how to get the total number of pages
[code]$(document).ready(function() {
oTable = $('#text_field').dataTable({
"bLengthChange": false,
"sScrollY": 232,
"bFilter": false,
"bSort": false,
"bInfo": false,
"bAutoWidth": false,
"bJQueryUI": true,
"sPaginationType": "full_numbers",
});
ctr=0;
setInterval(function(){
if (ctr <= [ TOTAL NUMBER OF PAGE ]){
oTable.fnPageChange( 'next' );
ctr=ctr+1;
}
else{
oTable.fnPageChange( 'first' );
ctr=0;
}
},1000);
} );
[/code]
Allan
oTable.fnPagingInfo().iTotalPages
[/code]
should be it.
Allan
[code]
max = oTable.fnPagingInfo().iTotalPages;
ctr=0;
setInterval(function(){
if (ctr <= max){
oTable.fnPageChange( 'next' );
ctr=ctr+1;
}
else{
oTable.fnPageChange( 'first' );
ctr=0;
}
},1000);
[/code]
and like this
[code]
if (ctr <= oTable.fnPagingInfo().iTotalPages){
}
[/code]
but it didn't work
Allan
ctr=0; // DEFAULT VALUE OF CTR
setInterval(function(){
if (ctr <= [ TOTAL NUMBER OF PAGE ]){
oTable.fnPageChange( 'next' );
ctr=ctr+1; // INCREASE VALUE OF CTR
}
else{
oTable.fnPageChange( 'first' );
ctr=0; // RESETS THE VALUE OF CTR TO 0
}
},1000);
[/code]
ctr is just a counter that increase each time the page change and resets when it reach the last page
Allan
if (ctr <= max){
}[/code]
[code]
if (ctr <= oTable.fnPagingInfo().iTotalPages){ // TEST IF IT CAN WORK LIKE THIS
}[/code]
[quote]What is the plug-in telling you are the number of pages - that seems to me to be the point which might be most likely to fail.[/quote]
I have no idea about this one. I'm just searching for the value that will give me the total number of pages so i think that the plugin you were talking about is irrelevant.
The plug-in will tell you that.
Add:
[code]
alert( oTable.fnPagingInfo().iTotalPages );
[/code]
What is the number that is alerted?
Allan
[code]
max = oTable.fnPagingInfo().iTotalPages; // MAX IS STILL NULL
[/code]
Here is an example of the plug-in being used to get the number of pages: http://live.datatables.net/ajiliw/edit#javascript,html .
If you can't get it to work, please link us to a test page showing the problem.
Allan
Allan