PHP Класс 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.
С версии: 3.0.2
Автор: Qiang Xue ([email protected])
Наследование: extends TWebControl, implements Prado\Web\UI\INamingContainer
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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 )

Защищенные методы

Метод Описание
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 )

Описание методов

bubbleEvent() публичный Метод

This method overrides parent's implementation by wrapping event parameter for OnCommand event with item information.
public bubbleEvent ( $sender, $param ) : boolean
Результат boolean whether the event bubbling should stop here.

buildListPager() защищенный Метод

Builds a dropdown list pager
protected buildListPager ( )

buildNextPrevPager() защищенный Метод

Builds a next-prev pager
protected buildNextPrevPager ( )

buildNumericPager() защищенный Метод

Builds a numeric pager
protected buildNumericPager ( )

buildPager() защищенный Метод

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

createPagerButton() защищенный Метод

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
Результат mixed the button instance

getButtonCssClass() публичный Метод

С версии: 3.2.1
public getButtonCssClass ( ) : string
Результат string the css class of the buttons.

getButtonType() публичный Метод

public getButtonType ( ) : TPagerButtonType
Результат TPagerButtonType the type of command button for paging. Defaults to TPagerButtonType::LinkButton.

getControlToPaginate() публичный Метод

public getControlToPaginate ( ) : string
Результат string the ID path of the control whose content would be paginated.

getCurrentPageIndex() публичный Метод

public getCurrentPageIndex ( ) : integer
Результат integer the zero-based index of the current page. Defaults to 0.

getFirstPageImageUrl() публичный Метод

С версии: 3.1.1
public getFirstPageImageUrl ( ) : string
Результат string the image URL for the first page button. This is only used when {@link getButtonType ButtonType} is 'ImageButton'.

getFirstPageText() публичный Метод

public getFirstPageText ( ) : string
Результат string text for the first page button. Defaults to '<<'.

getIsFirstPage() публичный Метод

public getIsFirstPage ( ) : boolean
Результат boolean whether the current page is the first page Defaults to false.

getIsLastPage() публичный Метод

public getIsLastPage ( ) : boolean
Результат boolean whether the current page is the last page

getLastPageImageUrl() публичный Метод

С версии: 3.1.1
public getLastPageImageUrl ( ) : string
Результат string the image URL for the last page button. This is only used when {@link getButtonType ButtonType} is 'ImageButton'.

getLastPageText() публичный Метод

public getLastPageText ( ) : string
Результат string text for the last page button. Defaults to '>>'.

getMode() публичный Метод

public getMode ( ) : TPagerMode
Результат TPagerMode pager mode. Defaults to TPagerMode::NextPrev.

getNextPageImageUrl() публичный Метод

С версии: 3.1.1
public getNextPageImageUrl ( ) : string
Результат string the image URL for the next page button. This is only used when {@link getButtonType ButtonType} is 'ImageButton'.

getNextPageText() публичный Метод

public getNextPageText ( ) : string
Результат string text for the next page button. Defaults to '>'.

getNumericPageImageUrl() публичный Метод

См. также: setNumericPageImageUrl
С версии: 3.1.1
public getNumericPageImageUrl ( ) : string
Результат 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 getPageButtonCount ( ) : integer
Результат integer maximum number of pager buttons to be displayed. Defaults to 10.

getPageCount() публичный Метод

public getPageCount ( ) : integer
Результат integer number of pages of data items available

getPageImageUrl() защищенный Метод

С версии: 3.1.1
protected getPageImageUrl ( $text, $commandName )

getPrevPageImageUrl() публичный Метод

С версии: 3.1.1
public getPrevPageImageUrl ( ) : string
Результат string the image URL for the previous page button. This is only used when {@link getButtonType ButtonType} is 'ImageButton'.

getPrevPageText() публичный Метод

public getPrevPageText ( ) : string
Результат string text for the previous page button. Defaults to '<'.

listIndexChanged() публичный Метод

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

loadState() публичный Метод

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

onPageIndexChanged() публичный Метод

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

onPreRender() публичный Метод

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

render() публичный Метод

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

setButtonCssClass() публичный Метод

С версии: 3.2.1
public setButtonCssClass ( $value )

setButtonType() публичный Метод

public setButtonType ( $value )

setControlToPaginate() публичный Метод

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 setCurrentPageIndex ( $value )

setFirstPageImageUrl() публичный Метод

С версии: 3.1.1
public setFirstPageImageUrl ( $value )

setFirstPageText() публичный Метод

public setFirstPageText ( $value )

setLastPageImageUrl() публичный Метод

С версии: 3.1.1
public setLastPageImageUrl ( $value )

setLastPageText() публичный Метод

public setLastPageText ( $value )

setMode() публичный Метод

public setMode ( $value )

setNextPageImageUrl() публичный Метод

С версии: 3.1.1
public setNextPageImageUrl ( $value )

setNextPageText() публичный Метод

public setNextPageText ( $value )

setNumericPageImageUrl() публичный Метод

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.
С версии: 3.1.1
public setNumericPageImageUrl ( $value )

setPageButtonCount() публичный Метод

public setPageButtonCount ( $value )

setPageCount() защищенный Метод

protected setPageCount ( $value )

setPrevPageImageUrl() публичный Метод

С версии: 3.1.1
public setPrevPageImageUrl ( $value )

setPrevPageText() публичный Метод

public setPrevPageText ( $value )