summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxue <>2006-11-26 20:09:44 +0000
committerxue <>2006-11-26 20:09:44 +0000
commite5477d462399aaf73836a069bc19775d7b8b1918 (patch)
treeaf580bf48f85e8814e7db0a1b49e104d8ca352ad
parent78bf7247e37a3bc15cbc604c5b2255de2f65c8f8 (diff)
Fixed the bug that TPager would not display if it was invisible previously
-rw-r--r--HISTORY1
-rw-r--r--framework/Web/UI/WebControls/TPager.php20
2 files changed, 18 insertions, 3 deletions
diff --git a/HISTORY b/HISTORY
index 8f4e9088..7c7b216c 100644
--- a/HISTORY
+++ b/HISTORY
@@ -4,6 +4,7 @@ BUG: Ticket#442 - TPageService getBasePath in namespace form (Qiang)
BUG: Ticket#467 - typo in TUrlMapping.php (Qiang)
BUG: TTableCell should render &nbsp; only when Text is not set and there's no child (Qiang)
BUG: global state was not saved when redirect() is invoked (Qiang)
+BUG: TPager would not display if it was invisible previously (Qiang)
ENH: Ticket#446 - Added TMetaTagCollection.getMetaTagByID method (Qiang)
CHG: Ticket#437 - __autoload is replaced by spl_autoload_register (Qiang)
CHG: Ticket#454 - Redundant PHP Version Check (Qiang)
diff --git a/framework/Web/UI/WebControls/TPager.php b/framework/Web/UI/WebControls/TPager.php
index e3aee892..df096125 100644
--- a/framework/Web/UI/WebControls/TPager.php
+++ b/framework/Web/UI/WebControls/TPager.php
@@ -51,6 +51,8 @@ class TPager extends TWebControl implements INamingContainer
const CMD_PAGE_FIRST='First';
const CMD_PAGE_LAST='Last';
+ private $_pageCount=0;
+
/**
* Restores the pager state.
* This method overrides the parent implementation and is invoked when
@@ -268,16 +270,28 @@ class TPager extends TWebControl implements INamingContainer
if(($targetControl=$this->getNamingContainer()->findControl($controlID))===null || !($targetControl instanceof TDataBoundControl))
throw new TConfigurationException('pager_controltopaginate_invalid',$controlID);
- if($targetControl->getAllowPaging() && $targetControl->getPageCount()>1)
+ if($targetControl->getAllowPaging())
{
- $this->setVisible(true);
+ $this->_pageCount=$targetControl->getPageCount();
$this->getControls()->clear();
$this->setPageCount($targetControl->getPageCount());
$this->setCurrentPageIndex($targetControl->getCurrentPageIndex());
$this->buildPager();
}
else
- $this->setVisible(false);
+ $this->_pageCount=0;
+ }
+
+ /**
+ * Renders the control.
+ * The method overrides the parent implementation by rendering
+ * the pager only when there are two or more pages.
+ * @param THtmlWriter the writer
+ */
+ public function render($writer)
+ {
+ if($this->_pageCount>1)
+ parent::render($writer);
}
/**