TPager creates a pager that provides UI for end-users to interactively
specify which page of data to be rendered in a {@link TDataBoundControl}-derived control,
such as {@link TDataList}, {@link TRepeater}, {@link TCheckBoxList}, etc.
The target data-bound control is specified by {@link setControlToPaginate ControlToPaginate},
which must be the ID path of the target control reaching from the pager's
naming container. Note, the target control must have its {@link TDataBoundControl::setAllowPaging AllowPaging}
set to true.
TPager can display three different UIs, specified via {@link setMode Mode}:
- NextPrev: a next page and a previous page button are rendered.
- Numeric: a list of page index buttons are rendered.
- List: a dropdown list of page indices are rendered.
When the pager mode is either NextPrev or Numeric, the paging buttons may be displayed
in three types by setting {@link setButtonType ButtonType}:
- LinkButton: a hyperlink button
- PushButton: a normal button
- ImageButton: an image button (please set XXXPageImageUrl properties accordingly to specify the button images.)
Since Prado 3.2.1, you can use the {@link setButtonCssClass ButtonCssClass} property to specify a css class
that will be applied to each button created by the pager in NextPrev or Numeric mode.
TPager raises an {@link onPageIndexChanged OnPageIndexChanged} event when
the end-user interacts with it and specifies a new page (e.g. clicking
on a page button that leads to a new page.) The new page index may be obtained
from the event parameter's property {@link TPagerPageChangedEventParameter::getNewPageIndex NewPageIndex}.
Normally, in the event handler, one can set the {@link TDataBoundControl::getCurrentPageIndex CurrentPageIndex}
to this new page index so that the new page of data is rendered.
Multiple pagers can be associated with the same data-bound control.