From 7bf5efc28c3bd0675778ddedc5ad6c6c5e2abc18 Mon Sep 17 00:00:00 2001 From: xue <> Date: Mon, 27 Nov 2006 03:28:24 +0000 Subject: merge from 3.0 branch till 1521. --- HISTORY | 2 ++ UPGRADE | 2 ++ framework/Web/UI/WebControls/TDataGrid.php | 6 +----- framework/Web/UI/WebControls/TPager.php | 20 +++++++++++++++++--- 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/HISTORY b/HISTORY index b66712cc..97027b00 100644 --- a/HISTORY +++ b/HISTORY @@ -21,10 +21,12 @@ BUG: Ticket#442 - TPageService getBasePath in namespace form (Qiang) BUG: Ticket#467 - typo in TUrlMapping.php (Qiang) BUG: TTableCell should render   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) CHG: Ticket#460 - Validators will not perform validation if parents are disabled (Qiang) +CHG: TDataGrid now does not set default table styles (Qiang) CHG: TRepeater does not render anymore for empty item template (Qiang) CHG: THttpRequest.constructUrl() now encodes ampersand by default (Qiang) diff --git a/UPGRADE b/UPGRADE index 97972ad9..641b5be9 100644 --- a/UPGRADE +++ b/UPGRADE @@ -26,6 +26,8 @@ Upgrading from v3.0.5 - TRepeater does not render anymore for empty item template. - constructUrl() now encodes ampersand by default. This should have minimal impact on any existing PRADO applications, though. +- TDataGrid does not generate default table styles. This may affect + the appearance of existing PRADO applications that use TDataGrid. Upgrading from v3.0.4 --------------------- diff --git a/framework/Web/UI/WebControls/TDataGrid.php b/framework/Web/UI/WebControls/TDataGrid.php index ccbd8be3..90042b12 100644 --- a/framework/Web/UI/WebControls/TDataGrid.php +++ b/framework/Web/UI/WebControls/TDataGrid.php @@ -276,11 +276,7 @@ class TDataGrid extends TBaseDataList implements INamingContainer */ protected function createStyle() { - $style=new TTableStyle; - $style->setGridLines('Both'); - $style->setCellSpacing(0); - $style->setBorderCollapse(true); - return $style; + return new TTableStyle; } /** 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); } /** -- cgit v1.2.3