The Paged View data set uses a number of built-in behaviors to enable paging.
For example, to create buttons for paging, you might add the following behaviors to the buttons:
<input type="button" value="First" onclick="pv1.firstPage();" /> <input type="button" value="Prev" onclick="pv1.previousPage();" /> <input type="button" value="Next" onclick="pv1.nextPage();" /> <input type="button" value="Last" onclick="pv1.lastPage();" />
In the preceding example, the value of the onclick behavior takes the form pagedViewDataSetName.behavior .
The following table shows the available behaviors.
Behavior |
Description |
---|---|
getPageCount() |
Returns the number of pages necessary to accommodate all of the data. This count is based on the specified page size and number of rows of data in the data set. |
getCurrentPage() |
Returns the page number or index for the data that is returned by a call to getData(). By default, the number that this method returns is between 1 and the page-count number. If you use the ZeroBasedIndexes constructor option and set it to true, this method returns a number between zero (0) and the page-count number, minus 1. |
goToPage(pageIndex) |
Filters the data to retrieve only rows associated with the specified page index through getData(). |
goToPageContainingRowID(rowID) |
Filters the data to retrieve only rows on the same page as the row with the specified row ID. |
goToPageContainingRowNumber(rowNumber) |
Filters the data to retrieve only rows on the same page as the row with the specified row number. |
goToPageContainingItemNumber(itemNumber) |
Filters the data to retrieve only rows on the same page as the row with the specified item number. |
firstPage() |
Filters the data to retrieve only rows on the first page. |
lastPage() |
Filters the data to retrieve only rows on the last page. |
previousPage() |
Filters the data set so that only rows in the previous page are available. |
nextPage() |
Filters the data to retrieve only rows on the next page. |
getPageForRowID(rowID) |
Returns the index of the page that contains the row with the specified ds_RowID. |
getPageForRowNumber(rowNumber) |
Returns the index of the page that contains the specified row number. |
getPageForItemNumber(itemNumber) |
Returns the index of the page that contains the specified item number. |
setPageSize(pageSize) |
Sets the maximum number of rows that can appear on a page. If set to zero (0), the behavior turns off paging. |