summaryrefslogtreecommitdiff
path: root/framework/Web/UI/WebControls/TListControl.php
diff options
context:
space:
mode:
authorxue <>2006-01-12 03:22:03 +0000
committerxue <>2006-01-12 03:22:03 +0000
commite126c0067e9efee6542d08bf649588e2cf3a5924 (patch)
treee1b14841cfdf8f05ce307ff9d63e8d2a466999a7 /framework/Web/UI/WebControls/TListControl.php
parenta06e326f247bff617191b1c87a7b004414495275 (diff)
Fixed several issues about viewstate handling. Prado Composer is nearly completed.
Diffstat (limited to 'framework/Web/UI/WebControls/TListControl.php')
-rw-r--r--framework/Web/UI/WebControls/TListControl.php19
1 files changed, 14 insertions, 5 deletions
diff --git a/framework/Web/UI/WebControls/TListControl.php b/framework/Web/UI/WebControls/TListControl.php
index f5619b45..7057e119 100644
--- a/framework/Web/UI/WebControls/TListControl.php
+++ b/framework/Web/UI/WebControls/TListControl.php
@@ -80,7 +80,10 @@ abstract class TListControl extends TDataBoundControl
* @var TListItemCollection item list
*/
private $_items=null;
-
+ /**
+ * @var boolean whether items are restored from viewstate
+ */
+ private $_loadedFromState=false;
/**
* @return string tag name of the list control
*/
@@ -137,7 +140,8 @@ abstract class TListControl extends TDataBoundControl
*/
public function addParsedObject($object)
{
- if($object instanceof TListItem)
+ // Do not add items from template if items are loaded from viewstate
+ if(!$this->_loadedFromState && ($object instanceof TListItem))
$this->getItems()->add($object);
}
@@ -190,14 +194,19 @@ abstract class TListControl extends TDataBoundControl
}
/**
- * Loads items into from viewstate.
+ * Loads items from viewstate.
* This method is invoked right after control state is loaded.
* @param mixed event parameter
*/
protected function onLoadState($param)
{
- $this->_items=new TListItemCollection;
- $this->_items->loadState($this->getViewState('Items',null));
+ $this->_loadedFromState=true;
+ if(!$this->getIsDataBound())
+ {
+ $this->_items=new TListItemCollection;
+ $this->_items->loadState($this->getViewState('Items',null));
+ }
+ $this->clearViewState('Items');
}
/**