summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxue <>2006-07-03 14:27:27 +0000
committerxue <>2006-07-03 14:27:27 +0000
commitf8ac882b55ae44c47e3269a5cd7b5f2fa308f10b (patch)
treec41e5dde2717b569ec19a4cf03695592aaa83260
parent2a1d1054624ce2673515ace042a8e933ea350683 (diff)
Fixed a bug that TDataGrid may complain getting ItemType on a non-object if the grid is not data-bound
-rw-r--r--HISTORY1
-rw-r--r--framework/Web/UI/WebControls/TDataGrid.php12
2 files changed, 11 insertions, 2 deletions
diff --git a/HISTORY b/HISTORY
index b59150c2..c6d39dc5 100644
--- a/HISTORY
+++ b/HISTORY
@@ -1,6 +1,7 @@
Version 3.0.3 August 6, 2006
============================
BUG: Ticket#264 - Typos in some exception throw statements (Knut)
+BUG: TDataGrid may complain getting ItemType on a non-object if the grid is not data-bound (Qiang)
NEW: Added TStyleSheet (Wei)
Version 3.0.2 July 2, 2006
diff --git a/framework/Web/UI/WebControls/TDataGrid.php b/framework/Web/UI/WebControls/TDataGrid.php
index fead5344..ab956d9c 100644
--- a/framework/Web/UI/WebControls/TDataGrid.php
+++ b/framework/Web/UI/WebControls/TDataGrid.php
@@ -213,7 +213,7 @@ class TDataGrid extends TBaseDataList implements INamingContainer
if($object instanceof TDataGridColumn)
$this->getColumns()->add($object);
else
- parent::addParsedObject($object);
+ parent::addParsedObject($object); // this is needed by EmptyTemplate
}
/**
@@ -247,6 +247,14 @@ class TDataGrid extends TBaseDataList implements INamingContainer
}
/**
+ * @return integer number of items
+ */
+ public function getItemCount()
+ {
+ return $this->_items?$this->_items->getCount():0;
+ }
+
+ /**
* Creates a style object for the control.
* This method creates a {@link TTableStyle} to be used by datagrid.
* @return TTableStyle control style to be used
@@ -1423,7 +1431,7 @@ class TDataGrid extends TBaseDataList implements INamingContainer
$this->renderContents($writer);
$control->renderEndTag($writer);
}
- else
+ else if($this->getViewState('ItemCount',0)>0)
{
$this->applyItemStyles();
if($this->_topPager)