public function gotoPage($pageIndex) { if ($pageIndex === $this->_currentPageIndex) { return $pageIndex; } if ($this->_customPaging) { if ($pageIndex >= 0 && ($this->_virtualCount < 0 || $pageIndex < $this->getPageCount())) { $param = new TPagedListFetchDataEventParameter($pageIndex, $this->_pageSize * $pageIndex, $this->_pageSize); $this->onFetchData($param); if (($data = $param->getData()) !== null) { $this->setReadOnly(false); $this->copyFrom($data); $this->setReadOnly(true); $oldPage = $this->_currentPageIndex; $this->_currentPageIndex = $pageIndex; $this->onPageIndexChanged(new TPagedListPageChangedEventParameter($oldPage)); return $pageIndex; } else { return false; } } else { return false; } } else { if ($pageIndex >= 0 && $pageIndex < $this->getPageCount()) { $this->_currentPageIndex = $pageIndex; $this->onPageIndexChanged(null); return $pageIndex; } else { return false; } } }
public function testIsLastPage() { $list = new TPagedList(array(1, 2, 3)); $list->PageSize = 1; $list->gotoPage(0); self::assertEquals(false, $list->IsLastPage); $list->gotoPage(2); self::assertEquals(true, $list->IsLastPage); }