|
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
-
TApplicationComponent
-
TControl
implements
IRenderable,
IBindable
-
TWebControl
implements
IStyleable
-
TPager
implements
INamingContainer
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
|
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
|
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
|
|
public
TPagerButtonType
|
#
getButtonType( )
Returns
TPagerButtonType
the type of command button for paging. Defaults to TPagerButtonType::LinkButton.
|
public
|
|
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
|
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.
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
|
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
|
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
|
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
|
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
Overrides
|
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
|
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
|
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
|
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
Returns
boolean whether the event bubbling should stop here.
Overrides
|
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 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
|
|