Class TPagedList
TPagedList class
TPagedList implements a list with paging functionality.
TPagedList works in one of two modes, managed paging or customized paging, specified by setCustomPaging CustomPaging.
- Managed paging (setCustomPaging CustomPaging=false) : the list is assumed to contain all data and it will manage which page of data are available to user.
- Customized paging (setCustomPaging CustomPaging=true) : the list is assumed to contain only one page of data. An onFetchData OnFetchData event will be raised if the list changes to a different page. Developers can attach a handler to the event and supply the needed data. The event handler can be written as follows,
public function fetchData($sender,$param) { $offset=$param->Offset; // beginning index of the data needed $limit=$param->Limit; // maximum number of data items needed // get data according to the above two parameters $param->Data=$data; }
Data in TPagedList can be accessed like an integer-indexed array and can be traversed using foreach. For example,
$count=$list->Count; for($index=0;$index<$count;++$index) echo $list[$index]; foreach($list as $index=>$item) // traverse each item in the list
The setPageSize PageSize property specifies the number of items in
each page. To access different page of data in the list, set setCurrentPageIndex CurrentPageIndex or call TPagedList::nextPage()
, TPagedList::previousPage()
, or TPagedList::gotoPage()
. The total number of pages can be
obtained by getPageCount() PageCount.
- TComponent
-
TList implements IteratorAggregate, ArrayAccess, Countable
-
TPagedList
Direct known subclasses
TSqlMapPagedListCopyright: Copyright © 2005-2014 PradoSoft
License: http://www.pradosoft.com/license/
Author: Qiang Xue <qiang.xue@gmail.com>
Since: 3.0
Located at Collections/TPagedList.php
public
|
|
public
boolean
|
|
public
|
|
public
integer
|
|
public
|
|
public
integer
|
|
public
|
|
public
|
#
onPageIndexChanged(
Raises OnPageIndexChanged event. This event is raised each time when the list changes to a different page. |
public
|
#
onFetchData(
Raises OnFetchData event. This event is raised each time when the list changes to a different page and needs the new page of data. This event can only be raised when setCustomPaging CustomPaging is true. |
public
integer|boolean
|
|
public
integer|boolean
|
|
public
integer|boolean
|
|
public
integer
|
|
public
|
|
public
integer
|
|
public
boolean
|
|
public
boolean
|
|
public
integer
|
|
public
Iterator
|
|
public
mixed
|
#
itemAt( integer $index )
Returns the item at the specified offset. This method is exactly the same as
|
public
integer
|
|
public
boolean
|
#
offsetExists( integer $offset )
Returns whether there is an item at the specified offset. This method is required by the interface ArrayAccess. |
public
mixed
|
#
offsetGet( integer $offset )
Returns the item at the specified offset. This method is required by the interface ArrayAccess. |
public
array
|
add(),
clear(),
contains(),
copyFrom(),
count(),
getReadOnly(),
insertAfter(),
insertAt(),
insertBefore(),
mergeWith(),
offsetSet(),
offsetUnset(),
remove(),
removeAt(),
setReadOnly()
|
GLOBAL_RAISE_EVENT_LISTENER
|