PRADO Component Framework for PHP 5
  • Home
  • About
  • Testimonials
  • Demos
  • Download
  • Documentation
  • Forum
  • Development
  • Tutorials
  • Class Docs
  • API Manual
  • Wiki

Packages

  • None
  • System
    • Caching
    • Collections
    • Data
      • ActiveRecord
        • Relations
        • Scaffold
          • InputBuilder
      • Commom
        • Sqlite
      • Common
        • Mssql
        • Mysql
        • Oracle
        • Pgsql
        • Sqlite
      • DataGateway
      • SqlMap
        • Configuration
        • Statements
    • Exceptions
    • I18N
    • IO
    • Security
    • Util
    • Web
      • Javascripts
      • Services
      • UI
        • ActiveControls
        • WebControls
    • Xml
  • Wsat
    • pages
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo

Class TPager

TPager class.

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 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 TDataBoundControl::setAllowPaging AllowPaging set to true.

TPager can display three different UIs, specified via 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 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 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 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 TPagerPageChangedEventParameter::getNewPageIndex NewPageIndex. Normally, in the event handler, one can set the 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.

TComponent
Extended by TApplicationComponent
Extended by TControl implements IRenderable, IBindable
Extended by TWebControl implements IStyleable
Extended by TPager implements INamingContainer

Direct known subclasses

TActivePager
Package: System\Web\UI\WebControls
Copyright: Copyright © 2005-2014 PradoSoft
License: http://www.pradosoft.com/license/
Author: Qiang Xue <qiang.xue@gmail.com>
Since: 3.0.2
Located at Web/UI/WebControls/TPager.php
Methods summary
public
# loadState( )

Restores the pager state. This method overrides the parent implementation and is invoked when the control is loading persistent state.

Restores the pager state. This method overrides the parent implementation and is invoked when the control is loading persistent state.

Overrides

TControl::loadState()
public string
# getControlToPaginate( )

Returns

string
the ID path of the control whose content would be paginated.
public
# setControlToPaginate( string $value )

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.

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.

Parameters

$value
string
the ID path
public string
# getButtonCssClass( )

Returns

string
the css class of the buttons.

Since

3.2.1
public
# setButtonCssClass( Sets $value )

Parameters

$value
Sets
the css class of the buttons that will be rendered by this pager.

Since

3.2.1
public TPagerMode
# getMode( )

Returns

TPagerMode
pager mode. Defaults to TPagerMode::NextPrev.
public
# setMode( TPagerMode $value )

Parameters

$value
TPagerMode
pager mode.
public TPagerButtonType
# getButtonType( )

Returns

TPagerButtonType
the type of command button for paging. Defaults to TPagerButtonType::LinkButton.
public
# setButtonType( TPagerButtonType $value )

Parameters

$value
TPagerButtonType
the type of command button for paging.
public string
# getNextPageText( )

Returns

string
text for the next page button. Defaults to '>'.
public
# setNextPageText( string $value )

Parameters

$value
string
text for the next page button.
public string
# getPrevPageText( )

Returns

string
text for the previous page button. Defaults to '<'.
public
# setPrevPageText( string $value )

Parameters

$value
string
text for the next page button.
public string
# getFirstPageText( )

Returns

string
text for the first page button. Defaults to '<<'.
public
# setFirstPageText( string $value )

Parameters

$value
string
text for the first page button. If empty, the first page button will not be rendered.
public string
# getLastPageText( )

Returns

string
text for the last page button. Defaults to '>>'.
public
# setLastPageText( string $value )

Parameters

$value
string
text for the last page button. If empty, the last page button will not be rendered.
public string
# getFirstPageImageUrl( )

Returns

string
the image URL for the first page button. This is only used when getButtonType ButtonType is 'ImageButton'.

Since

3.1.1
public
# setFirstPageImageUrl( string $value )

Parameters

$value
string
the image URL for the first page button. This is only used when getButtonType ButtonType is 'ImageButton'.

Since

3.1.1
public string
# getLastPageImageUrl( )

Returns

string
the image URL for the last page button. This is only used when getButtonType ButtonType is 'ImageButton'.

Since

3.1.1
public
# setLastPageImageUrl( string $value )

Parameters

$value
string
the image URL for the last page button. This is only used when getButtonType ButtonType is 'ImageButton'.

Since

3.1.1
public string
# getNextPageImageUrl( )

Returns

string
the image URL for the next page button. This is only used when getButtonType ButtonType is 'ImageButton'.

Since

3.1.1
public
# setNextPageImageUrl( string $value )

Parameters

$value
string
the image URL for the next page button. This is only used when getButtonType ButtonType is 'ImageButton'.

Since

3.1.1
public string
# getPrevPageImageUrl( )

Returns

string
the image URL for the previous page button. This is only used when getButtonType ButtonType is 'ImageButton'.

Since

3.1.1
public
# setPrevPageImageUrl( string $value )

Parameters

$value
string
the image URL for the previous page button. This is only used when getButtonType ButtonType is 'ImageButton'.

Since

3.1.1
public string
# getNumericPageImageUrl( )

Returns

string
the image URL for the numeric page buttons. This is only used when getButtonType ButtonType is 'ImageButton' and getMode Mode is 'Numeric'.

Since

3.1.1

See

TPager::setNumericPageImageUrl()
public
# setNumericPageImageUrl( string $value )

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.

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.

Parameters

$value
string
the image URL for the numeric page buttons. This is only used when getButtonType ButtonType is 'ImageButton' and getMode Mode is 'Numeric'.

Since

3.1.1
public integer
# getPageButtonCount( )

Returns

integer
maximum number of pager buttons to be displayed. Defaults to 10.
public
# setPageButtonCount( integer $value )

Parameters

$value
integer
maximum number of pager buttons to be displayed

Throws

TInvalidDataValueException
if the value is less than 1.
public integer
# getCurrentPageIndex( )

Returns

integer
the zero-based index of the current page. Defaults to 0.
protected
# setCurrentPageIndex( integer $value )

Parameters

$value
integer
the zero-based index of the current page

Throws

TInvalidDataValueException
if the value is less than 0
public integer
# getPageCount( )

Returns

integer
number of pages of data items available
protected
# setPageCount( integer $value )

Parameters

$value
integer
number of pages of data items available

Throws

TInvalidDataValueException
if the value is less than 0
public boolean
# getIsFirstPage( )

Returns

boolean
whether the current page is the first page Defaults to false.
public boolean
# getIsLastPage( )

Returns

boolean
whether the current page is the last page
public
# onPreRender( Traversable $param )

Performs databinding to populate data items from data source. This method is invoked by TControl::dataBind(). You may override this function to provide your own way of data population.

Performs databinding to populate data items from data source. This method is invoked by TControl::dataBind(). You may override this function to provide your own way of data population.

Parameters

$param
Traversable
the bound data

Overrides

TWebControl::onPreRender()
public
# render( THtmlWriter $writer )

Renders the control. The method overrides the parent implementation by rendering the pager only when there are two or more pages.

Renders the control. The method overrides the parent implementation by rendering the pager only when there are two or more pages.

Parameters

$writer
THtmlWriter
the writer

Overrides

TWebControl::render()
protected
# buildPager( )

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.

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 mixed
# createPagerButton( string $buttonType, boolean $enabled, string $text, string $commandName, string $commandParameter )

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.

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.

Parameters

$buttonType
string
button type, either LinkButton or PushButton
$enabled
boolean
whether the button should be enabled
$text
string
caption of the button.
$commandName
string
CommandName corresponding to the OnCommand event of the button.
$commandParameter
string
CommandParameter corresponding to the OnCommand event of the button

Returns

mixed
the button instance
protected
# getPageImageUrl( string $text, string $commandName )

Parameters

$text
string
the caption of the image button
$commandName
string
the command name associated with the image button

Since

3.1.1
protected
# buildNextPrevPager( )

Builds a next-prev pager

Builds a next-prev pager

protected
# buildNumericPager( )

Builds a numeric pager

Builds a numeric pager

protected
# buildListPager( )

Builds a dropdown list pager

Builds a dropdown list pager

public
# listIndexChanged( TDropDownList $sender, TEventParameter $param )

Event handler to the OnSelectedIndexChanged event of the dropdown list. This handler will raise onPageIndexChanged OnPageIndexChanged event.

Event handler to the OnSelectedIndexChanged event of the dropdown list. This handler will raise onPageIndexChanged OnPageIndexChanged event.

Parameters

$sender
TDropDownList
the dropdown list control raising the event
$param
TEventParameter
event parameter
public
# onPageIndexChanged( TPagerPageChangedEventParameter $param )

This event is raised when page index is changed due to a page button click.

This event is raised when page index is changed due to a page button click.

Parameters

$param
TPagerPageChangedEventParameter
event parameter
public boolean
# bubbleEvent( TControl $sender, TEventParameter $param )

Processes a bubbled event. This method overrides parent's implementation by wrapping event parameter for OnCommand event with item information.

Processes a bubbled event. This method overrides parent's implementation by wrapping event parameter for OnCommand event with item information.

Parameters

$sender
TControl
the sender of the event
$param
TEventParameter
event parameter

Returns

boolean
whether the event bubbling should stop here.

Overrides

TControl::bubbleEvent()
Methods inherited from TWebControl
addAttributesToRender(), clearStyle(), copyBaseAttributes(), createStyle(), getAccessKey(), getBackColor(), getBorderColor(), getBorderStyle(), getBorderWidth(), getCssClass(), getDecorator(), getDisplay(), getEnsureId(), getFont(), getForeColor(), getHasStyle(), getHeight(), getStyle(), getTabIndex(), getTagName(), getToolTip(), getWidth(), renderBeginTag(), renderContents(), renderEndTag(), setAccessKey(), setBackColor(), setBorderColor(), setBorderStyle(), setBorderWidth(), setCssClass(), setDisplay(), setEnsureId(), setForeColor(), setHeight(), setStyle(), setTabIndex(), setToolTip(), setWidth()
Methods inherited from TControl
__construct(), __get(), addParsedObject(), addToPostDataLoader(), addedControl(), applyStyleSheetSkin(), autoBindProperty(), autoDataBindProperties(), bindProperty(), broadcastEvent(), clearChildState(), clearControlState(), clearNamingContainer(), clearViewState(), convertUniqueIdToClientId(), createChildControls(), createControlCollection(), dataBind(), dataBindChildren(), dataBindProperties(), ensureChildControls(), findControl(), findControlsByID(), findControlsByType(), focus(), getAdapter(), getAllowChildControls(), getAttribute(), getAttributes(), getChildControlsCreated(), getClientID(), getControlStage(), getControlState(), getControls(), getCustomData(), getEnableTheming(), getEnableViewState(), getEnabled(), getHasAdapter(), getHasAttributes(), getHasChildInitialized(), getHasControls(), getHasInitialized(), getHasLoaded(), getHasLoadedPostData(), getHasPreRendered(), getID(), getIsSkinApplied(), getNamingContainer(), getPage(), getParent(), getRegisteredObject(), getSkinID(), getSourceTemplateControl(), getTemplateControl(), getUniqueID(), getViewState(), getVisible(), hasAttribute(), initRecursive(), isDescendentOf(), isObjectRegistered(), loadRecursive(), loadStateRecursive(), onDataBinding(), onInit(), onLoad(), onUnload(), preRenderRecursive(), raiseBubbleEvent(), registerObject(), removeAttribute(), removedControl(), renderChildren(), renderControl(), saveState(), saveStateRecursive(), setAdapter(), setAttribute(), setChildControlsCreated(), setControlStage(), setControlState(), setCustomData(), setEnableTheming(), setEnableViewState(), setEnabled(), setID(), setPage(), setSkinID(), setTemplateControl(), setViewState(), setVisible(), trackViewState(), traverseChildControls(), unbindProperty(), unloadRecursive(), unregisterObject()
Methods inherited from TApplicationComponent
getApplication(), getRequest(), getResponse(), getService(), getSession(), getUser(), publishAsset(), publishFilePath()
Methods inherited from TComponent
__call(), __destruct(), __isset(), __set(), __sleep(), __unset(), __wakeup(), asa(), attachBehavior(), attachBehaviors(), attachClassBehavior(), attachEventHandler(), canGetProperty(), canSetProperty(), clearBehaviors(), createdOnTemplate(), detachBehavior(), detachBehaviors(), detachClassBehavior(), detachEventHandler(), disableBehavior(), disableBehaviors(), enableBehavior(), enableBehaviors(), evaluateExpression(), evaluateStatements(), fxAttachClassBehavior(), fxDetachClassBehavior(), getAutoGlobalListen(), getBehaviorsEnabled(), getClassHierarchy(), getEventHandlers(), getListeningToGlobalEvents(), getSubProperty(), hasEvent(), hasEventHandler(), hasProperty(), isa(), listen(), raiseEvent(), setSubProperty(), unlisten()
Constants summary
string CMD_PAGE 'Page'
#

Command name that TPager understands.

Command name that TPager understands.

string CMD_PAGE_NEXT 'Next'
#
string CMD_PAGE_PREV 'Previous'
#
string CMD_PAGE_FIRST 'First'
#
string CMD_PAGE_LAST 'Last'
#
Constants inherited from TControl
AUTOMATIC_ID_PREFIX, CLIENT_ID_SEPARATOR, CS_CHILD_INITIALIZED, CS_CONSTRUCTED, CS_INITIALIZED, CS_LOADED, CS_PRERENDERED, CS_STATE_LOADED, ID_FORMAT, ID_SEPARATOR, IS_CHILD_CREATED, IS_CREATING_CHILD, IS_DISABLE_THEMING, IS_DISABLE_VIEWSTATE, IS_ID_SET, IS_SKIN_APPLIED, IS_STYLESHEET_APPLIED, RF_ADAPTER, RF_AUTO_BINDINGS, RF_CHILD_STATE, RF_CONTROLS, RF_CONTROLSTATE, RF_DATA_BINDINGS, RF_EVENTS, RF_NAMED_CONTROLS, RF_NAMED_CONTROLS_ID, RF_NAMED_OBJECTS, RF_SKIN_ID
Constants inherited from TComponent
GLOBAL_RAISE_EVENT_LISTENER
Properties inherited from TWebControl
$_decorator
Terms of Service | Contact Us
PRADO v3.2.4 API Manual API documentation generated by ApiGen 2.8.0
Copyright © 2006-2014 by the PRADO Group.
Powered by PRADO