summaryrefslogtreecommitdiff
path: root/framework/Web/UI/WebControls
diff options
context:
space:
mode:
authorxue <>2006-06-30 18:11:29 +0000
committerxue <>2006-06-30 18:11:29 +0000
commitdc9d45afeab16d4e20702b1de13113c7445f5d8c (patch)
tree4a0a75a51c4f07db2c7073db6a28b6e52751ceca /framework/Web/UI/WebControls
parent5fe30fbe079f37443857e720550e939b7dd988e6 (diff)
Fixed a bug in rendering datagrid when datasource is empty.
Diffstat (limited to 'framework/Web/UI/WebControls')
-rw-r--r--framework/Web/UI/WebControls/TDataGrid.php19
1 files changed, 13 insertions, 6 deletions
diff --git a/framework/Web/UI/WebControls/TDataGrid.php b/framework/Web/UI/WebControls/TDataGrid.php
index f811edaf..fead5344 100644
--- a/framework/Web/UI/WebControls/TDataGrid.php
+++ b/framework/Web/UI/WebControls/TDataGrid.php
@@ -954,9 +954,7 @@ 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,true,null,$columns);
+
$selectedIndex=$this->getSelectedItemIndex();
$editIndex=$this->getEditItemIndex();
foreach($data as $key=>$row)
@@ -965,6 +963,12 @@ class TDataGrid extends TBaseDataList implements INamingContainer
$keys->add($this->getDataFieldValue($row,$keyField));
else
$keys->add($key);
+ if($index===0)
+ {
+ if($allowPaging)
+ $this->_topPager=$this->createPager();
+ $this->_header=$this->createItemInternal(-1,-1,self::IT_HEADER,true,null,$columns);
+ }
if($index===$editIndex)
$itemType=self::IT_EDITITEM;
else if($index===$selectedIndex)
@@ -977,9 +981,12 @@ class TDataGrid extends TBaseDataList implements INamingContainer
$index++;
$dsIndex++;
}
- $this->_footer=$this->createItemInternal(-1,-1,self::IT_FOOTER,true,null,$columns);
- if($allowPaging)
- $this->_bottomPager=$this->createPager();
+ if($index>0)
+ {
+ $this->_footer=$this->createItemInternal(-1,-1,self::IT_FOOTER,true,null,$columns);
+ if($allowPaging)
+ $this->_bottomPager=$this->createPager();
+ }
}
$this->setViewState('ItemCount',$index,0);
if(!$dsIndex && $this->_emptyTemplate!==null)