- Home
- About
- Testimonials
- Demos
- Download
- Documentation
- Blogs
- Forum
- Support

Packages: default System System.Caching System.Collections System.Data System.Data.ActiveRecord System.Data.ActiveRecord.Relations System.Data.ActiveRecord.Scaffold System.Data.ActiveReecord.Scaffold.InputBuilder System.Data.Commom.Sqlite System.Data.Common System.Data.Common.Mssql System.Data.Common.Mysql System.Data.Common.Oracle System.Data.Common.Pgsql System.Data.Common.Sqlite System.Data.DataGateway System.Data.SqlMap System.Data.SqlMap.Configuration System.Data.SqlMap.Statements System.Exceptions System.I18N System.IO System.Security System.Util System.Web System.Web.Services System.Web.UI System.Web.UI.ActiveControls System.Web.UI.WebControls System.Web.UI.WebControls.assets System.Xml Classes: TAttributeCollection TDummyDataSource TDummyDataSourceIterator TList TListIterator TMap TMapIterator TPagedDataSource TPagedList TPagedListFetchDataEventParameter TPagedListIterator TPagedListPageChangedEventParameter TPagedMapIterator TQueue TQueueIterator TStack TStackIterator |
Keyword
# Class TPagedList
    TComponent
       |
       --TList
          |
          --TPagedList
- #### Direct Known Sub-classes: TSqlMapPagedList TPagedList class TPagedList implements a list with paging functionality. TPagedList works in one of two modes, managed paging or customized paging, specified by CustomPaging. Managed paging (CustomPaging=false) : the list is assumed to contain all data and it will manage which page of data are available to user. Customized paging (CustomPaging=true) : the list is assumed to contain only one page of data. An 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 PageSize property specifies the number of items in each page. To access different page of data in the list, set CurrentPageIndex or call nextPage(), previousPage(), or gotoPage(). The total number of pages can be obtained by PageCount. Since: 3.0 Author: Qiang Xue <qiang.xue@gmail.com>
Constructor Summary
public | __construct Array Constructor.
Method Summary
integer | getCount ()
integer | getCurrentPageIndex ()
boolean | getCustomPaging ()
boolean | getIsFirstPage ()
boolean | getIsLastPage ()
Iterator | getIterator ()
integer | getPageCount ()
integer | getPageSize ()
integer | getVirtualCount ()
integer|boolean | gotoPage ( integer $pageIndex) Changes to a page with the specified page index.
integer | indexOf ( mixed $item)
mixed | itemAt ( integer $index) Returns the item at the specified offset.
integer|boolean | nextPage () Switches to the next page.
boolean | offsetExists ( integer $offset) Returns whether there is an item at the specified offset.
mixed | offsetGet ( integer $offset) Returns the item at the specified offset.
void | onFetchData ( TPagedListFetchDataEventParameter $param) Raises OnFetchData event.
void | onPageIndexChanged ( TPagedListPageChangedEventParameter $param) Raises OnPageIndexChanged event.
integer|boolean | previousPage () Switches to the previous page.
void | setCurrentPageIndex ( integer $value)
void | setCustomPaging ( boolean $value)
void | setPageSize ( integer $value)
void | setVirtualCount ( integer $value)
array | toArray ()
Methods Inherited From TList
TList::add(), TList::clear(), TList::contains(), TList::copyFrom(), TList::count(), TList::getCount(), TList::getIterator(), TList::getReadOnly(), TList::indexOf(), TList::insertAt(), TList::itemAt(), TList::mergeWith(), TList::offsetExists(), TList::offsetGet(), TList::offsetSet(), TList::offsetUnset(), TList::remove(), TList::removeAt(), TList::setReadOnly(), TList::toArray()
Methods Inherited From TComponent
TComponent::addParsedObject(), TComponent::attachEventHandler(), TComponent::canGetProperty(), TComponent::canSetProperty(), TComponent::createdOnTemplate(), TComponent::detachEventHandler(), TComponent::evaluateExpression(), TComponent::evaluateStatements(), TComponent::getEventHandlers(), TComponent::getSubProperty(), TComponent::hasEvent(), TComponent::hasEventHandler(), TComponent::hasProperty(), TComponent::raiseEvent(), TComponent::setSubProperty(), TComponent::__get(), TComponent::__set()
Constructor Details
## __construct
public __construct | Array
Constructor.
Method Details
## getCount
public integer getCount | ()
Output
integer | the number of items in current page
Exception
## getCurrentPageIndex
public integer getCurrentPageIndex | ()
Output
integer | current page index. Defaults to 0.
Exception
## getCustomPaging
public boolean getCustomPaging | ()
Output
boolean | whether to use custom paging. Defaults to false.
Exception
## getIsFirstPage
public boolean getIsFirstPage | ()
Output
boolean | whether the current page is the first page
Exception
## getIsLastPage
public boolean getIsLastPage | ()
Output
boolean | whether the current page is the last page
Exception
## getIterator
public Iterator getIterator | ()
Output
Iterator | iterator
Exception
## getPageCount
public integer getPageCount | ()
Output
integer | number of pages, -1 if under custom paging mode and VirtualCount is not set.
Exception
## getPageSize
public integer getPageSize | ()
Output
integer | number of items in each page. Defaults to 10.
Exception
## getVirtualCount
public integer getVirtualCount | ()
Output
integer | user-assigned number of items in data source. Defaults to 0.
Exception
## gotoPage
public integer|boolean gotoPage | (integer $pageIndex )
Changes to a page with the specified page index.
Input
integer | $pageIndex | page index
Output
integer|boolean | the new page index, false if page index is out of range.
Exception
## indexOf
public integer indexOf | (mixed $item )
Input
mixed | $item | the item
Output
integer | the index of the item in the list (0 based), -1 if not found.
Exception
## itemAt
public mixed itemAt | (integer $index )
Returns the item at the specified offset. This method is exactly the same as offsetGet.
Input
integer | $index | the index of the item
Output
mixed | the item at the index
Exception
throws | TInvalidDataValueException if the index is out of the range
## nextPage
public integer|boolean nextPage | ()
Switches to the next page.
Output
integer|boolean | the new page index, false if next page is not available.
Exception
## offsetExists
public boolean offsetExists | (integer $offset )
Returns whether there is an item at the specified offset. This method is required by the interface ArrayAccess.
Input
integer | $offset | the offset to check on
Output
Exception
## offsetGet
public mixed offsetGet | (integer $offset )
Returns the item at the specified offset. This method is required by the interface ArrayAccess.
Input
integer | $offset | the offset to retrieve item.
Output
mixed | the item at the offset
Exception
throws | TInvalidDataValueException if the offset is invalid
## onFetchData
public void onFetchData | (TPagedListFetchDataEventParameter $param )
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 CustomPaging is true.
Input
TPagedListFetchDataEventParameter | $param | event parameter
Output
Exception
## onPageIndexChanged
public void onPageIndexChanged | (TPagedListPageChangedEventParameter $param )
Raises OnPageIndexChanged event. This event is raised each time when the list changes to a different page.
Input
TPagedListPageChangedEventParameter | $param | event parameter
Output
Exception
## previousPage
public integer|boolean previousPage | ()
Switches to the previous page.
Output
integer|boolean | the new page index, false if previous page is not available.
Exception
## setCurrentPageIndex
public void setCurrentPageIndex | (integer $value )
Input
integer | $value | current page index
Output
Exception
throws | TInvalidDataValueException if the page index is out of range
## setCustomPaging
public void setCustomPaging | (boolean $value )
Input
boolean | $value | whether to allow custom paging
Output
Exception
## setPageSize
public void setPageSize | (integer $value )
Input
integer | $value | number of items in each page
Output
Exception
## setVirtualCount
public void setVirtualCount | (integer $value )
Input
integer | $value | user-assigned number of items in data source
Output
Exception
## toArray
public array toArray | ()
Output
array | the list of items in array
Exception