summaryrefslogtreecommitdiff
path: root/framework/Web
diff options
context:
space:
mode:
authorxue <>2006-02-24 15:22:58 +0000
committerxue <>2006-02-24 15:22:58 +0000
commit6228d146f105f9edc88d3341dd68944e9bf8b882 (patch)
tree72159c2abcb3a618a4bb0f46931e4c0467b2d038 /framework/Web
parent35ff5d4dbae7cbae2bcb88b3ab4e78902f3a6846 (diff)
Fixed #69.
Diffstat (limited to 'framework/Web')
-rw-r--r--framework/Web/UI/WebControls/TDataGrid.php34
1 files changed, 29 insertions, 5 deletions
diff --git a/framework/Web/UI/WebControls/TDataGrid.php b/framework/Web/UI/WebControls/TDataGrid.php
index 4741b56e..c6d27b7e 100644
--- a/framework/Web/UI/WebControls/TDataGrid.php
+++ b/framework/Web/UI/WebControls/TDataGrid.php
@@ -184,7 +184,7 @@ class TDataGrid extends TBaseDataList implements INamingContainer
public function getColumns()
{
if(!$this->_columns)
- $this->_columns=new TDataGridColumnCollection;
+ $this->_columns=new TDataGridColumnCollection($this);
return $this->_columns;
}
@@ -194,7 +194,7 @@ class TDataGrid extends TBaseDataList implements INamingContainer
public function getAutoColumns()
{
if(!$this->_autoColumns)
- $this->_autoColumns=new TDataGridColumnCollection;
+ $this->_autoColumns=new TDataGridColumnCollection($this);
return $this->_autoColumns;
}
@@ -816,7 +816,7 @@ class TDataGrid extends TBaseDataList implements INamingContainer
$state=$this->getViewState('AutoColumns',array());
if(!empty($state))
{
- $this->_autoColumns=new TDataGridColumnCollection;
+ $this->_autoColumns=new TDataGridColumnCollection($this);
foreach($state as $st)
{
$column=new TBoundColumn;
@@ -1221,7 +1221,6 @@ class TDataGrid extends TBaseDataList implements INamingContainer
$column->setHeaderText($key);
$column->setDataField($key);
$column->setSortExpression($key);
- $column->setOwner($this);
$autoColumns->add($column);
}
else
@@ -1229,7 +1228,6 @@ class TDataGrid extends TBaseDataList implements INamingContainer
$column->setHeaderText('Item');
$column->setDataField($key);
$column->setSortExpression('Item');
- $column->setOwner($this);
$autoColumns->add($column);
}
}
@@ -1757,6 +1755,29 @@ class TDataGridItemCollection extends TList
class TDataGridColumnCollection extends TList
{
/**
+ * the control that owns this collection.
+ * @var TControl
+ */
+ private $_o;
+
+ /**
+ * Constructor.
+ * @param TDataGrid the control that owns this collection.
+ */
+ public function __construct(TDataGrid $owner)
+ {
+ $this->_o=$owner;
+ }
+
+ /**
+ * @return TDataGrid the control that owns this collection.
+ */
+ protected function getOwner()
+ {
+ return $this->_o;
+ }
+
+ /**
* Inserts an item at the specified position.
* This overrides the parent implementation by inserting only TDataGridColumn.
* @param integer the speicified position.
@@ -1766,7 +1787,10 @@ class TDataGridColumnCollection extends TList
public function insertAt($index,$item)
{
if($item instanceof TDataGridColumn)
+ {
+ $item->setOwner($this->_o);
parent::insertAt($index,$item);
+ }
else
throw new TInvalidDataTypeException('datagridcolumncollection_datagridcolumn_required');
}