diff options
author | xue <> | 2006-01-14 00:19:18 +0000 |
---|---|---|
committer | xue <> | 2006-01-14 00:19:18 +0000 |
commit | f16aa6762984e4d555a1cf93692db0a69fa2ab38 (patch) | |
tree | 5a460a73acb869cc58ecb1277118b2e039e0fd1b /framework/Web/UI/WebControls/TDataBoundControl.php | |
parent | f0737c5b52373f262a4c8cfd25d4e1bb6ff33aee (diff) |
Added TBaseDataList control. Updated class tree. Modified TTextBox about SafeHtml support. Modified TTextBox demo accordingly.
Diffstat (limited to 'framework/Web/UI/WebControls/TDataBoundControl.php')
-rw-r--r-- | framework/Web/UI/WebControls/TDataBoundControl.php | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/framework/Web/UI/WebControls/TDataBoundControl.php b/framework/Web/UI/WebControls/TDataBoundControl.php index ea2a0602..1108e0f6 100644 --- a/framework/Web/UI/WebControls/TDataBoundControl.php +++ b/framework/Web/UI/WebControls/TDataBoundControl.php @@ -192,15 +192,14 @@ abstract class TDataBoundControl extends TWebControl */
public function dataBind()
{
- // TODO: databinding should only be raised after data is ready
- // what about property bindings? should they be after data is ready?
$this->setRequiresDataBinding(false);
$this->dataBindProperties();
- if(($view=$this->getDataSourceView())!==null)
- $data=$view->select($this->getSelectParameters());
$this->onDataBinding(null);
- if($view!==null)
+ $data=$this->getData();
+ if($data instanceof Traversable)
$this->performDataBinding($data);
+ else if($data!==null)
+ throw new TInvalidDataTypeException('databoundcontrol_data_nontraversable');
$this->setIsDataBound(true);
$this->onDataBound(null);
}
@@ -211,6 +210,14 @@ abstract class TDataBoundControl extends TWebControl $this->setRequiresDataBinding(true);
}
+ protected function getData()
+ {
+ if(($view=$this->getDataSourceView())!==null)
+ return $view->select($this->getSelectParameters());
+ else
+ return null;
+ }
+
protected function getDataSourceView()
{
if(!$this->_currentViewValid)
|