Reputation: 3575
I'm using Google Charts to paginate a table and want to save the current page before redrawing so I will be able to set it as a startPage later on.
How can i access the table's current page?
Upvotes: 1
Views: 378
Reputation: 401
I know this is old, but I figured out how to do what you're wanting:
var currentPage = 0; //at the beginning of your code, like a chartWrapper
//in your ready event:
google.visualization.events.addListener(chart, 'page', function(e) { returnTablePage(e) });
//as a separate function:
function returnTablePage(e) { currentPage = e.page; }
I put it in a separate function because I need to do several things...
Upvotes: 1
Reputation: 3575
If this helps anyone,
I ended up using the Query Language in combination of a custom function on Page events.
The query enabled me to set an offset to the table and it works fine.
Here's a reference to the Query Language:
https://developers.google.com/chart/interactive/docs/querylanguage#Offset
https://developers.google.com/chart/interactive/docs/examples#tablequerywrapper
And that's how you run a custom function on Google Charts events:
https://developers.google.com/chart/interactive/docs/gallery/table#Configuration_Options
Upvotes: 0