getTotalPageCount( )

Gets the number of pages in the dataset.

The number of pages in a dataset is the number of total items divided by the page size. If there are any left over items, one more page is added.

For example, if you have 20 items and your page size is 6, you have 4 pages. The first 3 pages have 6 items each and the last page has 2 items.


A dataset needs to load its data before you call its getTotalPageCount() function. Usually a dataset finishes loading a short time after the page it is on finishes loading. So if you call getTotalPageCount() inside the page’s onReady() event handler, the dataset might not be ready yet.

To call getTotalPageCount() as soon as possible after a page loads, use the dataset's onReady() function inside the page’s onReady() event handler to ensure that both the page and the dataset have finished loading.

Method Declaration
This method does not take any parameters
Return Type:number
Was this helpful?