PHP 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 {@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.
Since: 3.0.2
Author: Qiang Xue ([email protected])
Inheritance: extends TWebControl, implements Prado\Web\UI\INamingContainer
Afficher le fichier Open project: pradosoft/prado Class Usage Examples

Méthodes publiques

Méthode Description
bubbleEvent ( $sender, $param ) : boolean Processes a bubbled event.
getButtonCssClass ( ) : string
getButtonType ( ) : TPagerButtonType
getControlToPaginate ( ) : string
getCurrentPageIndex ( ) : integer
getFirstPageImageUrl ( ) : string
getFirstPageText ( ) : string
getIsFirstPage ( ) : boolean
getIsLastPage ( ) : boolean
getLastPageImageUrl ( ) : string
getLastPageText ( ) : string
getMode ( ) : TPagerMode
getNextPageImageUrl ( ) : string
getNextPageText ( ) : string
getNumericPageImageUrl ( ) : string
getPageButtonCount ( ) : integer
getPageCount ( ) : integer
getPrevPageImageUrl ( ) : string
getPrevPageText ( ) : string
listIndexChanged ( $sender, $param ) Event handler to the OnSelectedIndexChanged event of the dropdown list.
loadState ( ) Restores the pager state.
onPageIndexChanged ( $param ) This event is raised when page index is changed due to a page button click.
onPreRender ( $param ) Performs databinding to populate data items from data source.
render ( $writer ) Renders the control.
setButtonCssClass ( $value )
setButtonType ( $value )
setControlToPaginate ( $value ) Sets the ID path of the control whose content would be paginated.
setFirstPageImageUrl ( $value )
setFirstPageText ( $value )
setLastPageImageUrl ( $value )
setLastPageText ( $value )
setMode ( $value )
setNextPageImageUrl ( $value )
setNextPageText ( $value )
setNumericPageImageUrl ( $value ) Sets the image URL for the numeric page buttons.
setPageButtonCount ( $value )
setPrevPageImageUrl ( $value )
setPrevPageText ( $value )

Méthodes protégées

Méthode Description
buildListPager ( ) Builds a dropdown list pager
buildNextPrevPager ( ) Builds a next-prev pager
buildNumericPager ( ) Builds a numeric pager
buildPager ( ) Builds the pager content based on the pager mode.
createPagerButton ( $buttonType, $enabled, $text, $commandName, $commandParameter ) : mixed Creates a pager button.
getPageImageUrl ( $text, $commandName )
setCurrentPageIndex ( $value )
setPageCount ( $value )

Method Details

bubbleEvent() public méthode

This method overrides parent's implementation by wrapping event parameter for OnCommand event with item information.
public bubbleEvent ( $sender, $param ) : boolean
Résultat boolean whether the event bubbling should stop here.

buildListPager() protected méthode

Builds a dropdown list pager
protected buildListPager ( )

buildNextPrevPager() protected méthode

Builds a next-prev pager
protected buildNextPrevPager ( )

buildNumericPager() protected méthode

Builds a numeric pager
protected buildNumericPager ( )

buildPager() protected méthode

Current implementation includes building 'NextPrev', 'Numeric' and 'DropDownList' pagers. Derived classes may override this method to provide additional pagers.
protected buildPager ( )

createPagerButton() protected méthode

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 createPagerButton ( $buttonType, $enabled, $text, $commandName, $commandParameter ) : mixed
Résultat mixed the button instance

getButtonCssClass() public méthode

Since: 3.2.1
public getButtonCssClass ( ) : string
Résultat string the css class of the buttons.

getButtonType() public méthode

public getButtonType ( ) : TPagerButtonType
Résultat TPagerButtonType the type of command button for paging. Defaults to TPagerButtonType::LinkButton.

getControlToPaginate() public méthode

public getControlToPaginate ( ) : string
Résultat string the ID path of the control whose content would be paginated.

getCurrentPageIndex() public méthode

public getCurrentPageIndex ( ) : integer
Résultat integer the zero-based index of the current page. Defaults to 0.

getFirstPageImageUrl() public méthode

Since: 3.1.1
public getFirstPageImageUrl ( ) : string
Résultat string the image URL for the first page button. This is only used when {@link getButtonType ButtonType} is 'ImageButton'.

getFirstPageText() public méthode

public getFirstPageText ( ) : string
Résultat string text for the first page button. Defaults to '<<'.

getIsFirstPage() public méthode

public getIsFirstPage ( ) : boolean
Résultat boolean whether the current page is the first page Defaults to false.

getIsLastPage() public méthode

public getIsLastPage ( ) : boolean
Résultat boolean whether the current page is the last page

getLastPageImageUrl() public méthode

Since: 3.1.1
public getLastPageImageUrl ( ) : string
Résultat string the image URL for the last page button. This is only used when {@link getButtonType ButtonType} is 'ImageButton'.

getLastPageText() public méthode

public getLastPageText ( ) : string
Résultat string text for the last page button. Defaults to '>>'.

getMode() public méthode

public getMode ( ) : TPagerMode
Résultat TPagerMode pager mode. Defaults to TPagerMode::NextPrev.

getNextPageImageUrl() public méthode

Since: 3.1.1
public getNextPageImageUrl ( ) : string
Résultat string the image URL for the next page button. This is only used when {@link getButtonType ButtonType} is 'ImageButton'.

getNextPageText() public méthode

public getNextPageText ( ) : string
Résultat string text for the next page button. Defaults to '>'.

getNumericPageImageUrl() public méthode

See also: setNumericPageImageUrl
Since: 3.1.1
public getNumericPageImageUrl ( ) : string
Résultat string the image URL for the numeric page buttons. This is only used when {@link getButtonType ButtonType} is 'ImageButton' and {@link getMode Mode} is 'Numeric'.

getPageButtonCount() public méthode

public getPageButtonCount ( ) : integer
Résultat integer maximum number of pager buttons to be displayed. Defaults to 10.

getPageCount() public méthode

public getPageCount ( ) : integer
Résultat integer number of pages of data items available

getPageImageUrl() protected méthode

Since: 3.1.1
protected getPageImageUrl ( $text, $commandName )

getPrevPageImageUrl() public méthode

Since: 3.1.1
public getPrevPageImageUrl ( ) : string
Résultat string the image URL for the previous page button. This is only used when {@link getButtonType ButtonType} is 'ImageButton'.

getPrevPageText() public méthode

public getPrevPageText ( ) : string
Résultat string text for the previous page button. Defaults to '<'.

listIndexChanged() public méthode

This handler will raise {@link onPageIndexChanged OnPageIndexChanged} event.
public listIndexChanged ( $sender, $param )

loadState() public méthode

This method overrides the parent implementation and is invoked when the control is loading persistent state.
public loadState ( )

onPageIndexChanged() public méthode

This event is raised when page index is changed due to a page button click.
public onPageIndexChanged ( $param )

onPreRender() public méthode

This method is invoked by {@link dataBind()}. You may override this function to provide your own way of data population.
public onPreRender ( $param )

render() public méthode

The method overrides the parent implementation by rendering the pager only when there are two or more pages.
public render ( $writer )

setButtonCssClass() public méthode

Since: 3.2.1
public setButtonCssClass ( $value )

setButtonType() public méthode

public setButtonType ( $value )

setControlToPaginate() public méthode

The ID path is the dot-connected IDs of the controls reaching from the pager's naming container to the target control.
public setControlToPaginate ( $value )

setCurrentPageIndex() protected méthode

protected setCurrentPageIndex ( $value )

setFirstPageImageUrl() public méthode

Since: 3.1.1
public setFirstPageImageUrl ( $value )

setFirstPageText() public méthode

public setFirstPageText ( $value )

setLastPageImageUrl() public méthode

Since: 3.1.1
public setLastPageImageUrl ( $value )

setLastPageText() public méthode

public setLastPageText ( $value )

setMode() public méthode

public setMode ( $value )

setNextPageImageUrl() public méthode

Since: 3.1.1
public setNextPageImageUrl ( $value )

setNextPageText() public méthode

public setNextPageText ( $value )

setNumericPageImageUrl() public méthode

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.
Since: 3.1.1
public setNumericPageImageUrl ( $value )

setPageButtonCount() public méthode

public setPageButtonCount ( $value )

setPageCount() protected méthode

protected setPageCount ( $value )

setPrevPageImageUrl() public méthode

Since: 3.1.1
public setPrevPageImageUrl ( $value )

setPrevPageText() public méthode

public setPrevPageText ( $value )