public function onPreRender($param)
{
parent::onPreRender($param);
$controlID = $this->getControlToPaginate();
if (($targetControl = $this->getNamingContainer()->findControl($controlID)) === null || !$targetControl instanceof TDataBoundControl) {
throw new TConfigurationException('pager_controltopaginate_invalid', $controlID);
}
if ($targetControl->getAllowPaging()) {
$this->_pageCount = $targetControl->getPageCount();
$this->getControls()->clear();
$this->setPageCount($targetControl->getPageCount());
$this->setCurrentPageIndex($targetControl->getCurrentPageIndex());
$this->buildPager();
} else {
$this->_pageCount = 0;
}
}