Class \Prado\Web\UI\WebControls\TPager
TPager creates a pager that provides UI for end-users to interactively specify which page of data to be rendered in a TDataBoundControl-derived control, such as TDataList, TRepeater, TCheckBoxList, etc. The target data-bound control is specified by \Prado\Web\UI\WebControls\setControlToPaginate, which must be the ID path of the target control reaching from the pager's naming container. Note, the target control must have its \Prado\Web\UI\WebControls\TDataBoundControl::setAllowPaging set to true.
TPager can display three different UIs, specified via \Prado\Web\UI\WebControls\setMode:
- 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 \Prado\Web\UI\WebControls\setButtonType:
- 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 \Prado\Web\UI\WebControls\setButtonCssClass 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 \Prado\Web\UI\WebControls\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 \Prado\Web\UI\WebControls\TPagerPageChangedEventParameter::getNewPageIndex. Normally, in the event handler, one can set the \Prado\Web\UI\WebControls\TDataBoundControl::getCurrentPageIndex 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.
Class hierarchy
- \Prado\Web\UI\WebControls\TPager implements INamingContainer
- \Prado\Web\UI\WebControls\TWebControl implements IStyleable
- \Prado\Web\UI\TControl implements IRenderable, IBindable
- \Prado\TApplicationComponent
- \Prado\TComponent
Since: 3.0.2
public
|
bubbleEvent(TControl $sender, TEventParameter $param) : bool
Processes a bubbled event.
This method overrides parent's implementation by wrapping event parameter for OnCommand event with item information. |
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
listIndexChanged(TDropDownList $sender, TEventParameter $param) : mixed
Event handler to the OnSelectedIndexChanged event of the dropdown list.
This handler will raise \Prado\Web\UI\WebControls\onPageIndexChanged event. |
public
|
loadState() : mixed
Restores the pager state.
This method overrides the parent implementation and is invoked when the control is loading persistent state. |
public
|
onPageIndexChanged(TPagerPageChangedEventParameter $param) : mixed
This event is raised when page index is changed due to a page button click.
|
public
|
onPreRender(Traversable $param) : mixed
Performs databinding to populate data items from data source.
This method is invoked by dataBind(). You may override this function to provide your own way of data population. |
public
|
render(THtmlWriter $writer) : mixed
Renders the control.
The method overrides the parent implementation by rendering the pager only when there are two or more pages. |
public
|
|
public
|
|
public
|
setControlToPaginate(string $value) : mixed
Sets the ID path of the control whose content would be paginated.
The ID path is the dot-connected IDs of the controls reaching from the pager's naming container to the target control. |
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
setNumericPageImageUrl(string $value) : mixed
Sets the image URL for the numeric page buttons.
This is actually a template for generating a set of URLs corresponding to numeric button 1, 2, 3, .., etc. Use {0} as the placeholder for the numbers. For example, the image URL http://example.com/images/button{0}.gif will be replaced as http://example.com/images/button1.gif, http://example.com/images/button2.gif, etc. |
public
|
|
public
|
|
public
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
buildPager() : mixed
Builds the pager content based on the pager mode.
Current implementation includes building 'NextPrev', 'Numeric' and 'DropDownList' pagers. Derived classes may override this method to provide additional pagers. |
protected
|
createPagerButton(string $buttonType, bool $enabled, string $text, string $commandName, string $commandParameter) : mixed
Creates a pager button.
Depending on the button type, a TLinkButton or a TButton may be created. If it is enabled (clickable), its command name and parameter will also be set. Derived classes may override this method to create additional types of buttons, such as TImageButton. |
protected
|
|
protected
|
|
protected
|
public
mixed
|
CMD_PAGE
Command name that TPager understands.
|
'Page'
|
public
mixed
|
CMD_PAGE_FIRST
|
'First'
|
public
mixed
|
CMD_PAGE_LAST
|
'Last'
|
public
mixed
|
CMD_PAGE_NEXT
|
'Next'
|
public
mixed
|
CMD_PAGE_PREV
|
'Previous'
|