is there any way to understans when there are no more records to show in google visualisation table

26 views
Skip to first unread message

Tanya Marinova

unread,
Jan 15, 2013, 4:29:53 AM1/15/13
to google-visua...@googlegroups.com
I've gor a big database with over 30 000 rows on my server. I want to make a request to the server giving me the first 100 records and showing them with googlevisualisation table paging api - 10 records per page!!! The problem is that when i show all this 100 records and my next button is disabled i want to make another ajax call to the server giving me the next 100 rows. so is there any way to understand when there are no more records and we are at the last page so i can make ajax call  for anoher 100 records.

asgallant

unread,
Jan 15, 2013, 11:33:45 AM1/15/13
to google-visua...@googlegroups.com
Add an event listener for the "page" event and test the page property of the event:

google.visualization.events.addListener(visualization'page'function (e{
    if (e.page == numberOfPages 1{
        // we have reached the last page, make an AJAX call for more data
    }
});

Tanya Marinova

unread,
Jan 17, 2013, 4:21:13 AM1/17/13
to google-visua...@googlegroups.com
OK thank you for your answer  but that way it  shows only for a second my last page and immediately loads the first page of my new 100 records ( it doesn't wait to click the next button  and it doesn't change my page property and i need it because i show the number of page in a text box)!  So the result is only after clicking the next button it shows in the text box   page 2 (before that when i show the first 10 records of my new 100 records it shows page 10 because the page property wasn't modified and there was no page event )

So now my question now is : is there any way to load the new records but only after clicking the next button which will change my page property also?

asgallant

unread,
Jan 17, 2013, 12:09:03 PM1/17/13
to google-visua...@googlegroups.com
Are you replacing the existing data set or adding on to it?  The problem with waiting for a "next" button click on the last page is that the "next" button will be greyed out at that point, so the API won't register any click events on it.
Reply all
Reply to author
Forward
0 new messages