page.info() doesnt refresh when i change page

page.info() doesnt refresh when i change page

Cyri1Cyri1 Posts: 8Questions: 3Answers: 0

Hello,
How can i refresh page.info() : when page 1 or page 2 is selected the result is the same vartable.page.info(); in console :
{page: 0, pages: 5, start: 0, end: 10, length: 10, …}
thanks !!

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,237Questions: 1Answers: 2,598

    Seems to work here. Could you look at that, please, and see if it helps. If it's still not working for you, please can you update my example, or link to your page, so that we can see the problem.

    Cheers,

    Colin

  • Cyri1Cyri1 Posts: 8Questions: 3Answers: 0

    Yes it works with table.page(2).draw(false);
    but my goal is to automatically loop through all pages so i can't use this in my script.
    I did it with jquery click (next button) and lenght (count number of pages) but i think its better to use DataTables API ...

  • kthorngrenkthorngren Posts: 21,167Questions: 26Answers: 4,921

    but my goal is to automatically loop through all pages

    How do you want to loop through the pages? As Colin asked please update his example so we can see what you are trying to do. Otherwise we will be guessing at what the solution should be.

    Kevin

  • Cyri1Cyri1 Posts: 8Questions: 3Answers: 0
                setInterval(
                    function() {
                        var nbrepages = $("#table_paginate > span > a").length;
                        var current = $('.current').html();
    
                        if (nbrepages > current) {
                            //$('#table_next').click();
                            table.page('next').draw('page');
                        } else {
                            table.page('first').draw('page');
                        }
    
                    }, 10000);
    

    it works but if its possible to use page.info instead of jquery its better

  • kthorngrenkthorngren Posts: 21,167Questions: 26Answers: 4,921
    Answer ✓

    I built a test case for you:
    http://live.datatables.net/febuxeyo/2/edit

    Updated it yo use the page.info() API.

    Kevin

  • Cyri1Cyri1 Posts: 8Questions: 3Answers: 0

    Thanks!

This discussion has been closed.