From 2e473b200186161248b8c0d568c176d16bd2e590 Mon Sep 17 00:00:00 2001 From: xue <> Date: Tue, 4 Jul 2006 15:35:38 +0000 Subject: Fixed a bug related with postback and EmptyTemplate. --- framework/Web/UI/WebControls/TDataGrid.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'framework/Web/UI') diff --git a/framework/Web/UI/WebControls/TDataGrid.php b/framework/Web/UI/WebControls/TDataGrid.php index 1a81974e..f7697fec 100644 --- a/framework/Web/UI/WebControls/TDataGrid.php +++ b/framework/Web/UI/WebControls/TDataGrid.php @@ -900,13 +900,16 @@ class TDataGrid extends TBaseDataList implements INamingContainer { foreach($columns as $column) $column->initialize(); - if($allowPaging) - $this->_topPager=$this->createPager(); - $this->_header=$this->createItemInternal(-1,-1,self::IT_HEADER,false,null,$columns); $selectedIndex=$this->getSelectedItemIndex(); $editIndex=$this->getEditItemIndex(); for($index=0;$index<$itemCount;++$index) { + if($index===0) + { + if($allowPaging) + $this->_topPager=$this->createPager(); + $this->_header=$this->createItemInternal(-1,-1,self::IT_HEADER,false,null,$columns); + } if($index===$editIndex) $itemType=self::IT_EDITITEM; else if($index===$selectedIndex) @@ -918,9 +921,12 @@ class TDataGrid extends TBaseDataList implements INamingContainer $items->add($this->createItemInternal($index,$dsIndex,$itemType,false,null,$columns)); $dsIndex++; } - $this->_footer=$this->createItemInternal(-1,-1,self::IT_FOOTER,false,null,$columns); - if($allowPaging) - $this->_bottomPager=$this->createPager(); + if($index>0) + { + $this->_footer=$this->createItemInternal(-1,-1,self::IT_FOOTER,false,null,$columns); + if($allowPaging) + $this->_bottomPager=$this->createPager(); + } } if(!$dsIndex && $this->_emptyTemplate!==null) { -- cgit v1.2.3