diff options
author | xue <> | 2006-01-30 04:46:34 +0000 |
---|---|---|
committer | xue <> | 2006-01-30 04:46:34 +0000 |
commit | 984ffd32335727c8329cb15d777fbc9adc0d3052 (patch) | |
tree | 34f8a137ba67403797732114bafcab32a9671c57 | |
parent | f7b1db61531f9309dc9a1b9587449442a7ae5ed5 (diff) |
Modified viewstate saving method so that much smaller state data is generated.
-rw-r--r-- | demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample2.page | 3 | ||||
-rw-r--r-- | framework/Web/UI/TControl.php | 17 |
2 files changed, 12 insertions, 8 deletions
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample2.page b/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample2.page index 174f132c..dbfc7a18 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample2.page +++ b/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample2.page @@ -2,7 +2,8 @@ <h1>TRepeater Sample 2</h1>
-<com:TRepeater ID="Repeater" OnItemDataBound="dataBindRepeater2">
+<com:TRepeater ID="Repeater"
+ OnItemDataBound="dataBindRepeater2">
<prop:HeaderTemplate>
<table cellspacing="1" style="border-collapse: collapse;border:1px solid silver">
diff --git a/framework/Web/UI/TControl.php b/framework/Web/UI/TControl.php index 8b272f30..7b9fee4e 100644 --- a/framework/Web/UI/TControl.php +++ b/framework/Web/UI/TControl.php @@ -1320,12 +1320,14 @@ class TControl extends TComponent {
if(isset($state[$control->_id]))
{
- $s=&$state[$control->_id];
+ $control->loadStateRecursive($state[$control->_id],$needViewState);
unset($state[$control->_id]);
}
else
- $s=null;
- $control->loadStateRecursive($s,$needViewState);
+ {
+ $s=array();
+ $control->loadStateRecursive($s,$needViewState);
+ }
}
}
}
@@ -1339,9 +1341,9 @@ class TControl extends TComponent }
/**
- * Saves the all control state (viewstate and controlstate) as a collection.
+ * Saves all control state (viewstate and controlstate) as a collection.
* @param boolean whether the viewstate should be saved
- * @return TMap the collection of the control state (including its children's state).
+ * @return array the collection of the control state (including its children's state).
*/
final protected function &saveStateRecursive($needViewState=true)
{
@@ -1355,11 +1357,12 @@ class TControl extends TComponent if($control instanceof TControl)
{
$cs=&$control->saveStateRecursive($needViewState);
- $state[$control->_id]=&$cs;
+ if(!empty($cs))
+ $state[$control->_id]=&$cs;
}
}
}
- if($needViewState)
+ if($needViewState && !empty($this->_viewState))
$state[0]=&$this->_viewState;
if(isset($this->_rf[self::RF_CONTROLSTATE]))
$state[1]=&$this->_rf[self::RF_CONTROLSTATE];
|