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 {@link setPageSize PageSize} property specifies the number of items in each page.
To access different page of data in the list, set {@link setCurrentPageIndex CurrentPageIndex}
or call {@link nextPage()}, {@link previousPage()}, or {@link gotoPage()}.
The total number of pages can be obtained by {@link getPageCount() PageCount}.
파일 보기
프로젝트 열기: pradosoft/prado
1 사용 예제들
메소드 | 설명 | |
---|---|---|
__construct ( $data = null, $readOnly = false ) | Constructor. | |
getCount ( ) : integer | ||
getCurrentPageIndex ( ) : integer | ||
getCustomPaging ( ) : boolean | ||
getIsFirstPage ( ) : boolean | ||
getIsLastPage ( ) : boolean | ||
getIterator ( ) : Iterator | ||
getPageCount ( ) : integer | ||
getPageSize ( ) : integer | ||
getVirtualCount ( ) : integer | ||
gotoPage ( $pageIndex ) : integer | boolean | Changes to a page with the specified page index. | |
indexOf ( $item ) : integer | ||
itemAt ( $index ) : mixed | Returns the item at the specified offset. | |
nextPage ( ) : integer | boolean | Switches to the next page. | |
offsetExists ( $offset ) : boolean | Returns whether there is an item at the specified offset. | |
offsetGet ( $offset ) : mixed | Returns the item at the specified offset. | |
onFetchData ( $param ) | Raises OnFetchData event. | |
onPageIndexChanged ( $param ) | Raises OnPageIndexChanged event. | |
previousPage ( ) : integer | boolean | Switches to the previous page. | |
setCurrentPageIndex ( $value ) | ||
setCustomPaging ( $value ) | ||
setPageSize ( $value ) | ||
setVirtualCount ( $value ) | ||
toArray ( ) : array |
public getCurrentPageIndex ( ) : integer | ||
리턴 | integer | current page index. Defaults to 0. |
public getCustomPaging ( ) : boolean | ||
리턴 | boolean | whether to use custom paging. Defaults to false. |
public getIsFirstPage ( ) : boolean | ||
리턴 | boolean | whether the current page is the first page |
public getIsLastPage ( ) : boolean | ||
리턴 | boolean | whether the current page is the last page |
public getPageCount ( ) : integer | ||
리턴 | integer | number of pages, -1 if under custom paging mode and {@link setVirtualCount VirtualCount} is not set. |
public getPageSize ( ) : integer | ||
리턴 | integer | number of items in each page. Defaults to 10. |
public getVirtualCount ( ) : integer | ||
리턴 | integer | user-assigned number of items in data source. Defaults to 0. |
public offsetExists ( $offset ) : boolean | ||
리턴 | boolean |
public onFetchData ( $param ) |
public onPageIndexChanged ( $param ) |
public previousPage ( ) : integer | boolean | ||
리턴 | integer | boolean | the new page index, false if previous page is not available. |