public function dataBind()
{
$this->setRequiresDataBinding(false);
$this->dataBindProperties();
$this->onDataBinding(null);
if (($view = $this->getDataSourceView()) !== null) {
$data = $view->select($this->getSelectParameters());
} else {
$data = null;
}
if ($data instanceof \Traversable) {
if ($this->getAllowPaging()) {
$ds = $this->createPagedDataSource();
$ds->setDataSource($data);
$this->setViewState('PageCount', $ds->getPageCount());
if ($ds->getCurrentPageIndex() >= $ds->getPageCount()) {
$ds->setCurrentPageIndex($ds->getPageCount() - 1);
$this->setCurrentPageIndex($ds->getCurrentPageIndex());
}
$this->performDataBinding($ds);
} else {
$this->clearViewState('PageCount');
$this->performDataBinding($data);
}
}
$this->setIsDataBound(true);
$this->onDataBound(null);
}